C300_025
C300_소스코드
1 2 3 4 5 6 7 8 9 10 | #include <stdio.h> main() { int x = 5, y = 2; printf("%d \n", x / y); // 2 printf("%f \n", (double)x / y); // 2.500000 } | cs |
IDA - Layout Graph
IDA - Text View
cdq(Conver Dword to Qword): dword크기를 qword 크기로 확장
idiv: 음수를 포함한 수를 나눌 때 필요한 명령어
cvtsi2sd(Convert Doubleword Integer to Scalar Double-Precision Floating-Point Value):
- 4바이트 정수 --> 배정도 실수형의 스칼라 값으로 변환
- 단정도 (float) 32bit, 배정도 (double) 64bit
divsd(Divide Scalar Double-Precision Floating-Point Value):
실수를 나눌 때 사용하는 명령어이다. 결과갑은 destination operand에 저장된다.
자세한 내용은 아래를 참고.
pseudo code - 의사코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> main() { int x; int y; int var_10; x = 5; y = 2; eax = x eax = eax / y; printf(_Format, eax); xmm0 = x; xmm1 = y; xmm0 = xmm0 / xmm1 [esp + 10h + var_10] = xmm0; printf(asc_403028); eax = 0; } | cs |
pseudo code - 최종 의사 코드
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <stdio.h> main() { int x; int y; int var_10; x = 5; y = 2; printf(_Format, x/y); printf(asc_403028, (double)x/y); } | cs |
'Reversing > ASM to C' 카테고리의 다른 글
ASM to C with IDA - 027 (0) | 2018.06.01 |
---|---|
ASM to C with IDA - 026 (0) | 2018.06.01 |
ASM to C with IDA - 024 (0) | 2018.05.31 |
ASM to C with IDA - 023 (0) | 2018.05.31 |
ASM to C with IDA - 022 (0) | 2018.05.30 |