#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 /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strrev(char *);
int main(void) {
  int x;
  int y;
  int z;
  int max = 0;
  char a[7];
  char b[7];
  for (x = 999; x > 99; x--) {
    for (y = 999; y > 99; y--) {
      z = x * y;
      sprintf(a, "%d", z);
      strcpy(b, a);
      strrev(b);
      if (strcmp(a, b) == 0) {
        if (z > max) {
          max = z;
        }
      }
    }
  }
  printf("Answer = %d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x3e7,-0x8(%rbp)
cmpl   $0x63,-0x8(%rbp)
jle    120f <main+0xbf>
movl   $0x3e7,-0xc(%rbp)
cmpl   $0x63,-0xc(%rbp)
jle    11fc <main+0xac>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x1b(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xe60(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x22(%rbp),%rdi
lea    -0x1b(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x22(%rbp),%rdi
call   1060 <strrev@plt>
lea    -0x1b(%rbp),%rdi
lea    -0x22(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e9 <main+0x99>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11e4 <main+0x94>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e9 <main+0x99>
jmp    11ee <main+0x9e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <main+0x2e>
jmp    1201 <main+0xb1>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x1d>
mov    -0x14(%rbp),%esi
lea    0xdea(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x3e7,%eax
xor    %ebx,%ebx
mov    $0xf3a71,%ebp
mov    $0xfffffc19,%r13d
lea    0x21(%rsp),%r15
lea    0x1a(%rsp),%r12
jmp    119b <main+0x4b>
nopl   0x0(%rax)
mov    0x10(%rsp),%rcx
lea    -0x1(%rcx),%eax
mov    0xc(%rsp),%ebp
add    $0xfffffc19,%ebp
add    $0x1,%r13d
cmp    $0x64,%ecx
jbe    11fc <main+0xac>
mov    %rax,0x10(%rsp)
mov    $0x3e8,%r14d
mov    %ebp,0xc(%rsp)
jmp    11c3 <main+0x73>
nopl   0x0(%rax)
test   %rax,%rax
cmove  %ecx,%ebx
add    $0xffffffff,%r14d
add    %r13d,%ebp
cmp    $0x64,%r14d
jbe    1180 <main+0x30>
mov    %r15,%rdi
lea    0xe33(%rip),%rsi
mov    %ebp,%edx
call   1070 <sprintf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
call   1060 <strrev@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
mov    %ebp,%ecx
cmp    %ebx,%ebp
jg     11b0 <main+0x60>
mov    %ebx,%ecx
jmp    11b0 <main+0x60>
lea    0xe00(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%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 = [13 x i8] c"Answer = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [7 x i8]
%7 = alloca [7 x i8]
store i32 0, i32* %1
store i32 0, i32* %5
store i32 999, i32* %2
br label %8
8: ; preds = %43, %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 99
br i1 %10, label %11, label %46
11: ; preds = %8
store i32 999, i32* %3
br label %12
12: ; preds = %39, %11
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 99
br i1 %14, label %15, label %42
15: ; preds = %12
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = mul nsw i32 %16, %17
store i32 %18, i32* %4
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%20 = load i32, i32* %4
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%24 = call i32 @strcpy(i8* %22, i8* %23)
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%26 = call i32 @strrev(i8* %25)
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %15
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load i32, i32* %4
store i32 %36, i32* %5
br label %37
37: ; preds = %35, %31
br label %38
38: ; preds = %37, %15
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, -1
store i32 %41, i32* %3
br label %12
42: ; preds = %12
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add nsw i32 %44, -1
store i32 %45, i32* %2
br label %8
46: ; preds = %8
%47 = load i32, i32* %5
%48 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"Answer = %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %0, %22
%6 = phi i32 [ 0, %0 ], [ %19, %22 ]
%7 = phi i32 [ 999, %0 ], [ %23, %22 ]
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ %6, %5 ], [ %19, %8 ]
%10 = phi i32 [ 999, %5 ], [ %20, %8 ]
%11 = mul nuw nsw i32 %10, %7
%12 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @strcpy(i8* %4, i8* %3)
%14 = call i32 @strrev(i8* %4)
%15 = call i64 @strcmp(i8* %3, i8* %4)
%16 = icmp eq i64 %15, 0
%17 = icmp sgt i32 %11, %9
%18 = select i1 %16, i1 %17, i1 false
%19 = select i1 %18, i32 %11, i32 %9
%20 = add nsw i32 %10, -1
%21 = icmp ugt i32 %10, 100
br i1 %21, label %8, label %22
22: ; preds = %8
%23 = add nsw i32 %7, -1
%24 = icmp ugt i32 %7, 100
br i1 %24, label %5, label %25
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %19)
ret i32 0
}