#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 /*<<< orphan*/ reverse(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int i, j;
  int longest = -1;
  char s1[7];
  char s2[7];
  for (i = 999; i > 0; i--) {
    for (j = 999; j > 0; j--) {
      int sum = i * j;
      sprintf(s1, "%d", sum);
      strcpy(s2, s1);
      reverse(s2);
      if (strcmp(s1, s2) == 0 && sum > longest)
        longest = sum;
    }
  }
  longest > 0 ? printf("%d\n", longest)
              : printf("No palindromic number present");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x10(%rbp)
movl   $0x3e7,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    120a <main+0xba>
movl   $0x3e7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11f7 <main+0xa7>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x17(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe60(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x1e(%rbp),%rdi
lea    -0x17(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x1e(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x17(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11e4 <main+0x94>
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11e4 <main+0x94>
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11e9 <main+0x99>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <main+0x2e>
jmp    11fc <main+0xac>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x1d>
cmpl   $0x0,-0x10(%rbp)
jle    122a <main+0xda>
mov    -0x10(%rbp),%esi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1238 <main+0xe8>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1050 <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    $0xffffffff,%ebx
mov    $0x3e7,%eax
mov    $0xf3a71,%ebp
mov    $0xfffffc19,%r13d
lea    0x21(%rsp),%r15
lea    0x1a(%rsp),%r12
jmp    119b <main+0x4b>
nop
mov    0x10(%rsp),%rcx
lea    -0x1(%rcx),%eax
mov    0xc(%rsp),%ebp
add    $0xfffffc19,%ebp
add    $0x1,%r13d
cmp    $0x1,%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    $0x1,%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   1040 <strcpy@plt>
mov    %r12,%rdi
call   1030 <reverse@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
mov    %ebp,%ecx
cmp    %ebx,%ebp
jg     11b0 <main+0x60>
mov    %ebx,%ecx
jmp    11b0 <main+0x60>
test   %ebx,%ebx
jle    1212 <main+0xc2>
lea    0xdfc(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1220 <main+0xd0>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1050 <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 = [4 x i8] c"%d\0A\00"
@.str.2 = [30 x i8] c"No palindromic number present\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [7 x i8]
%6 = alloca [7 x i8]
%7 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %4
store i32 999, i32* %2
br label %8
8: ; preds = %42, %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %45
11: ; preds = %8
store i32 999, i32* %3
br label %12
12: ; preds = %38, %11
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %41
15: ; preds = %12
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = mul nsw i32 %16, %17
store i32 %18, i32* %7
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%20 = load i32, i32* %7
%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]* %6, i64 0, i64 0
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%24 = call i32 @strcpy(i8* %22, i8* %23)
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%26 = call i32 @reverse(i8* %25)
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %15
%32 = load i32, i32* %7
%33 = load i32, i32* %4
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load i32, i32* %7
store i32 %36, i32* %4
br label %37
37: ; preds = %35, %31, %15
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = add nsw i32 %39, -1
store i32 %40, i32* %3
br label %12
41: ; preds = %12
br label %42
42: ; preds = %41
%43 = load i32, i32* %2
%44 = add nsw i32 %43, -1
store i32 %44, i32* %2
br label %8
45: ; preds = %8
%46 = load i32, i32* %4
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* %4
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %45
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %48
%54 = phi i32 [ %50, %48 ], [ %52, %51 ]
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [30 x i8] c"No palindromic number present\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 [ 999, %0 ], [ %23, %22 ]
%7 = phi i32 [ -1, %0 ], [ %19, %22 ]
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ %7, %5 ], [ %19, %8 ]
%10 = phi i32 [ 999, %5 ], [ %20, %8 ]
%11 = mul nuw nsw i32 %10, %6
%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 @reverse(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, 1
br i1 %21, label %8, label %22
22: ; preds = %8
%23 = add nsw i32 %6, -1
%24 = icmp ugt i32 %6, 1
br i1 %24, label %5, label %25
25: ; preds = %22
%26 = icmp sgt i32 %19, 0
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %31
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
ret i32 0
}