#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 isPalindrome();
int /*<<< orphan*/ printToHex();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ toHex(int);
int main() {
  int num;
  scanf("%d", &num);
  toHex(num);
  if (isPalindrome() == 1) {
    printToHex();
  } else {
    do {
      num++;
      toHex(num);
    } while (isPalindrome() == 0);
    printToHex();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <toHex@plt>
mov    $0x0,%al
call   1050 <isPalindrome@plt>
cmp    $0x1,%eax
jne    1183 <main+0x43>
mov    $0x0,%al
call   1040 <printToHex@plt>
jmp    11b0 <main+0x70>
jmp    1188 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <toHex@plt>
mov    $0x0,%al
call   1050 <isPalindrome@plt>
cmp    $0x0,%eax
je     1188 <main+0x48>
mov    $0x0,%al
call   1040 <printToHex@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <toHex@plt>
xor    %eax,%eax
call   1050 <isPalindrome@plt>
cmp    $0x1,%eax
je     118b <main+0x4b>
nopw   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
add    $0x1,%edi
mov    %edi,0x4(%rsp)
call   1030 <toHex@plt>
xor    %eax,%eax
call   1050 <isPalindrome@plt>
test   %eax,%eax
je     1170 <main+0x30>
xor    %eax,%eax
call   1040 <printToHex@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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