#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
char *revStr(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(int argc, char const *argv[]) {
  for (int x = 100; x < 1000; x++) {
    for (int y = 100; y < 1000; y++) {
      int z = x * y;
      char *zStr;
      sprintf(zStr, "%d", z);
      char *zRev = revStr(zStr);
      int zRevInt = atoi(zRev);
      if (z == zRevInt) {
        printf("%d\n", zRevInt);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x64,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    11f5 <main+0xb5>
movl   $0x64,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    11e2 <main+0xa2>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe6a(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <revStr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jne    11cf <main+0x8f>
mov    -0x34(%rbp),%esi
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
jmp    11d4 <main+0x94>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <main+0x31>
jmp    11e7 <main+0xa7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x64,%r13d
mov    $0x2710,%r12d
lea    0xea2(%rip),%r15
lea    0xe9e(%rip),%r14
jmp    1181 <main+0x41>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13d
add    $0x64,%r12d
cmp    $0x3e8,%r13d
je     11bf <main+0x7f>
mov    $0x384,%ebx
mov    %r12d,%ebp
jmp    1198 <main+0x58>
nopl   0x0(%rax,%rax,1)
add    %r13d,%ebp
add    $0xffffffff,%ebx
je     1170 <main+0x30>
mov    %r15,%rsi
mov    %ebp,%edx
call   1060 <sprintf@plt>
call   1030 <revStr@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
cmp    %eax,%ebp
jne    1190 <main+0x50>
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %6
br label %12
12: ; preds = %41, %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 1000
br i1 %14, label %15, label %44
15: ; preds = %12
store i32 100, i32* %7
br label %16
16: ; preds = %37, %15
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 1000
br i1 %18, label %19, label %40
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = mul nsw i32 %20, %21
store i32 %22, i32* %8
%23 = load i8*, i8** %9
%24 = load i32, i32* %8
%25 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i8*, i8** %9
%27 = call i8* @revStr(i8* %26)
store i8* %27, i8** %10
%28 = load i8*, i8** %10
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %11
%30 = load i32, i32* %8
%31 = load i32, i32* %11
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %19
%34 = load i32, i32* %11
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %19
br label %37
37: ; preds = %36
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %16
40: ; preds = %16
br label %41
41: ; preds = %40
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %12
44: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %6
%4 = phi i32 [ 100, %2 ], [ %7, %6 ]
br label %9
5: ; preds = %6
ret i32 0
6: ; preds = %18
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 1000
br i1 %8, label %5, label %3
9: ; preds = %3, %18
%10 = phi i32 [ 100, %3 ], [ %19, %18 ]
%11 = mul nuw nsw i32 %10, %4
%12 = tail call i32 @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i8* @revStr(i8* undef)
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp eq i32 %11, %14
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %18
18: ; preds = %16, %9
%19 = add nuw nsw i32 %10, 1
%20 = icmp eq i32 %19, 1000
br i1 %20, label %6, label %9
}