#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 is_it_palindrome(int, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  char num_hex[16];
  scanf("%d", &num);
  while (is_it_palindrome(num, num_hex) != 1) {
    num++;
  }
  printf("%s", num_hex);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <is_it_palindrome@plt>
cmp    $0x1,%eax
je     1172 <main+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <main+0x1f>
lea    -0x20(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rsi
call   1030 <is_it_palindrome@plt>
cmp    $0x1,%eax
je     1178 <main+0x48>
lea    0x10(%rsp),%rbx
xchg   %ax,%ax
mov    0xc(%rsp),%edi
add    $0x1,%edi
mov    %edi,0xc(%rsp)
mov    %rbx,%rsi
call   1030 <is_it_palindrome@plt>
cmp    $0x1,%eax
jne    1160 <main+0x30>
lea    0xe84(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [16 x i8]
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %5
5: ; preds = %10, %0
%6 = load i32, i32* %2
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = call i32 @is_it_palindrome(i32 %6, i8* %7)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %5
13: ; preds = %5
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 @is_it_palindrome(i32 %6, i8* %4)
%8 = icmp eq i32 %7, 1
br i1 %8, label %14, label %9
9: ; preds = %0, %9
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
%12 = call i32 @is_it_palindrome(i32 %11, i8* %4)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %9
14: ; preds = %9, %0
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}