#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 */
scalar_t__ isPal(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, j, a, s = 0;
  for (i = 99; i > 0; i--) {
    for (j = 999; j > 0; j--) {
      if (11 * i <= 999 && j > 100) {
        a = 11 * i * j;
        if (a > 100001 && isPal(a))
          if (a > s)
            s = a;
      }
    }
  }
  printf("Problem 4: %d\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x63,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11dd <main+0xbd>
movl   $0x3e7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11ca <main+0xaa>
imul   $0xb,-0x8(%rbp),%eax
cmp    $0x3e7,%eax
jg     11b7 <main+0x97>
cmpl   $0x64,-0xc(%rbp)
jle    11b7 <main+0x97>
imul   $0xb,-0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x186a1,-0x10(%rbp)
jle    11b2 <main+0x92>
mov    -0x10(%rbp),%edi
call   1030 <isPal@plt>
cmp    $0x0,%rax
je     11b2 <main+0x92>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11ad <main+0x8d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11b2 <main+0x92>
jmp    11b7 <main+0x97>
jmp    11bc <main+0x9c>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114e <main+0x2e>
jmp    11cf <main+0xaf>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x14(%rbp),%esi
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x63,%r12d
xor    %r15d,%r15d
mov    $0x1099a7,%ebp
mov    $0xfffffbbf,%r13d
jmp    116c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%r12),%eax
mov    0x4(%rsp),%ebp
add    $0xffffd513,%ebp
add    $0xb,%r13d
cmp    $0x1,%r12d
mov    %eax,%r12d
jbe    11bc <main+0x9c>
lea    (%r12,%r12,4),%eax
lea    (%r12,%rax,2),%ebx
mov    $0x3e8,%r14d
mov    %ebp,0x4(%rsp)
jmp    1189 <main+0x69>
add    %r13d,%ebp
cmp    $0x1,%r14d
jbe    1150 <main+0x30>
add    $0xffffffff,%r14d
cmp    $0x3e7,%ebx
ja     1180 <main+0x60>
cmp    $0x65,%r14d
jb     1180 <main+0x60>
cmp    $0x186a2,%ebp
jl     1180 <main+0x60>
mov    %ebp,%edi
call   1030 <isPal@plt>
cmp    %r15d,%ebp
mov    %r15d,%ecx
cmovg  %ebp,%ecx
test   %rax,%rax
cmovne %ecx,%r15d
jmp    1180 <main+0x60>
lea    0xe3d(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Problem 4: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 99, i32* %2
br label %6
6: ; preds = %44, %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %47
9: ; preds = %6
store i32 999, i32* %3
br label %10
10: ; preds = %40, %9
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %43
13: ; preds = %10
%14 = load i32, i32* %2
%15 = mul nsw i32 11, %14
%16 = icmp sle i32 %15, 999
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 100
br i1 %19, label %20, label %39
20: ; preds = %17
%21 = load i32, i32* %2
%22 = mul nsw i32 11, %21
%23 = load i32, i32* %3
%24 = mul nsw i32 %22, %23
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 100001
br i1 %26, label %27, label %38
27: ; preds = %20
%28 = load i32, i32* %4
%29 = call i64 @isPal(i32 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %27
%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, %27, %20
br label %39
39: ; preds = %38, %17, %13
br label %40
40: ; preds = %39
%41 = load i32, i32* %3
%42 = add nsw i32 %41, -1
store i32 %42, i32* %3
br label %10
43: ; preds = %10
br label %44
44: ; preds = %43
%45 = load i32, i32* %2
%46 = add nsw i32 %45, -1
store i32 %46, i32* %2
br label %6
47: ; preds = %6
%48 = load i32, i32* %5
%49 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %48)
ret i32 0
}

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