#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__ check_palindrom(char *);
int /*<<< orphan*/ get_hex(int, char *);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main() {
  int number, i;
  char hex[10];
  for (i = 0; i < 10; i++)
    hex[i] = 0;
  scanf("%d", &number);
  get_hex(number, hex);
  while (1) {
    get_hex(number, hex);
    if (check_palindrom(hex)) {
      for (i = 0; i < strlen(hex); i++)
        printf("%c", hex[i]);
      break;
    } else {
      number++;
      get_hex(number, hex);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1187 <main+0x37>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x16(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <main+0x16>
lea    0xe72(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
lea    -0x16(%rbp),%rsi
call   1050 <get_hex@plt>
mov    -0x8(%rbp),%edi
lea    -0x16(%rbp),%rsi
call   1050 <get_hex@plt>
lea    -0x16(%rbp),%rdi
call   1070 <check_palindrom@plt>
cmp    $0x0,%rax
je     120d <main+0xbd>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x16(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    1208 <main+0xb8>
movslq -0xc(%rbp),%rax
lea    0xe13(%rip),%rdi
movsbl -0x16(%rbp,%rax,1),%esi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c9 <main+0x79>
jmp    1227 <main+0xd7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x16(%rbp),%rsi
call   1050 <get_hex@plt>
jmp    11a3 <main+0x53>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movw   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe90(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <get_hex@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1050 <get_hex@plt>
mov    %rbx,%rdi
call   1070 <check_palindrom@plt>
test   %rax,%rax
jne    11dc <main+0x8c>
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    0xc(%rsp),%edi
add    $0x1,%edi
mov    %edi,0xc(%rsp)
mov    %rbx,%rsi
call   1050 <get_hex@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1050 <get_hex@plt>
mov    %rbx,%rdi
call   1070 <check_palindrom@plt>
test   %rax,%rax
je     11b0 <main+0x60>
lea    0x10(%rsp),%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1220 <main+0xd0>
xor    %ebx,%ebx
lea    0xe10(%rip),%r14
lea    0x10(%rsp),%r15
nopl   0x0(%rax,%rax,1)
movsbl 0x10(%rsp,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1200 <main+0xb0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = call i32 @get_hex(i32 %17, i8* %18)
br label %20
20: ; preds = %15, %49
%21 = load i32, i32* %2
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%23 = call i32 @get_hex(i32 %21, i8* %22)
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%25 = call i64 @check_palindrom(i8* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %43
27: ; preds = %20
store i32 0, i32* %3
br label %28
28: ; preds = %39, %27
%29 = load i32, i32* %3
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%31 = call i32 @strlen(i8* %30)
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %42
33: ; preds = %28
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %28
42: ; preds = %28
br label %50
43: ; preds = %20
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
%46 = load i32, i32* %2
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%48 = call i32 @get_hex(i32 %46, i8* %47)
br label %49
49: ; preds = %43
br label %20
50: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @get_hex(i32 %7, i8* %5)
%9 = load i32, i32* %1
%10 = call i32 @get_hex(i32 %9, i8* %5)
%11 = call i64 @check_palindrom(i8* %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %25, %0
%14 = call i32 @strlen(i8* %5)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %13, %16
%17 = phi i64 [ %21, %16 ], [ 0, %13 ]
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %19)
%21 = add nuw nsw i64 %17, 1
%22 = call i32 @strlen(i8* %5)
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %16, label %33
25: ; preds = %0, %25
%26 = load i32, i32* %1
%27 = add nsw i32 %26, 1
store i32 %27, i32* %1
%28 = call i32 @get_hex(i32 %27, i8* %5)
%29 = load i32, i32* %1
%30 = call i32 @get_hex(i32 %29, i8* %5)
%31 = call i64 @check_palindrom(i8* %5)
%32 = icmp eq i64 %31, 0
br i1 %32, label %25, label %13
33: ; preds = %16, %13
ret i32 0
}