#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*/ scanf(char *, int *);
int main() {
  int number;
  scanf("%d", &number);
  int counter = 0;
  int hex[200];
  int how_many = 2;
  for (; counter != how_many / 2; number++) {
    int help_number = number;
    for (counter = 0; help_number > 0; help_number /= 16, counter++) {
      hex[counter] = help_number % 16;
    }
    how_many = counter;
    int reverse_counter = how_many - 1;
    for (counter = 0; counter < how_many / 2; counter++, reverse_counter--) {
      if (hex[counter] != hex[reverse_counter])
        break;
    }
  }
  for (counter = 0; counter < how_many; counter++) {
    switch (hex[counter]) {
    case 10:
      printf("A");
      break;
    case 11:
      printf("B");
      break;
    case 12:
      printf("C");
      break;
    case 13:
      printf("D");
      break;
    case 14:
      printf("E");
      break;
    case 15:
      printf("F");
      break;
    default:
      printf("%d", hex[counter]);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xedf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0x334(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x340(%rbp)
mov    -0x334(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x340(%rbp),%eax
cmp    %ecx,%eax
je     1271 <main+0x151>
mov    -0x8(%rbp),%eax
mov    %eax,-0x338(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x338(%rbp)
jle    11d2 <main+0xb2>
mov    -0x338(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
movslq -0xc(%rbp),%rax
mov    %edx,-0x330(%rbp,%rax,4)
mov    -0x338(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x338(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <main+0x6a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x334(%rbp)
mov    -0x334(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x33c(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x344(%rbp)
mov    -0x334(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x344(%rbp),%eax
cmp    %ecx,%eax
jge    125e <main+0x13e>
movslq -0xc(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%eax
movslq -0x33c(%rbp),%rcx
cmp    -0x330(%rbp,%rcx,4),%eax
je     123c <main+0x11c>
jmp    125e <main+0x13e>
jmp    1241 <main+0x121>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x33c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x33c(%rbp)
jmp    11f1 <main+0xd1>
jmp    1263 <main+0x143>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <main+0x33>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    135c <main+0x23c>
movslq -0xc(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0x350(%rbp)
sub    $0x5,%eax
ja     1330 <main+0x210>
mov    -0x350(%rbp),%rax
lea    0xd4b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1349 <main+0x229>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1349 <main+0x229>
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1349 <main+0x229>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1349 <main+0x229>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1349 <main+0x229>
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1349 <main+0x229>
movslq -0xc(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%esi
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    134e <main+0x22e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1278 <main+0x158>
xor    %eax,%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x338,%rsp
lea    0xed3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%r10d
mov    $0x1,%r8d
jmp    1170 <main+0x40>
nopl   0x0(%rax)
mov    %ecx,%r9d
add    $0x1,%r10d
cmp    %edi,%r9d
je     1200 <main+0xd0>
test   %r10d,%r10d
jle    12a7 <main+0x177>
mov    $0x1,%eax
xor    %ebx,%ebx
mov    %r10d,%edi
mov    %r10d,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdx
mov    %eax,%esi
mov    %edi,%eax
and    $0xf,%eax
mov    %eax,0x10(%rsp,%rbx,4)
shr    $0x4,%ecx
add    $0x1,%rbx
lea    0x1(%rsi),%eax
cmp    $0x10,%edi
mov    %ecx,%edi
jae    1190 <main+0x60>
mov    %ebx,%edi
shr    %edi
xor    %r9d,%r9d
cmp    $0x2,%ebx
jb     1163 <main+0x33>
cmp    $0x2,%edi
mov    $0x1,%r9d
cmovae %edi,%r9d
shr    %esi
cmp    $0x2,%esi
cmovb  %r8d,%esi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%rcx,4),%eax
cmp    0x10(%rsp,%rdx,4),%eax
jne    1160 <main+0x30>
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdx
cmp    %rcx,%rsi
jne    11e0 <main+0xb0>
jmp    1163 <main+0x33>
mov    %r10d,0xc(%rsp)
test   %ebx,%ebx
je     12a7 <main+0x177>
add    $0xffffffffffffffff,%rbx
mov    $0xffffffffffffffff,%r15
lea    0xdf9(%rip),%r14
lea    0xdda(%rip),%r12
jmp    1249 <main+0x119>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r15
cmp    %r15,%rbx
je     12a7 <main+0x177>
mov    0x14(%rsp,%r15,4),%esi
lea    -0xa(%rsi),%eax
cmp    $0x5,%eax
ja     1228 <main+0xf8>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    $0x41,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x110>
mov    $0x42,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x110>
mov    $0x43,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x110>
mov    $0x44,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x110>
mov    $0x45,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x110>
mov    $0x46,%edi
call   1030 <putchar@plt>
jmp    1240 <main+0x110>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"A\00"
@.str.2 = [2 x i8] c"B\00"
@.str.3 = [2 x i8] c"C\00"
@.str.4 = [2 x i8] c"D\00"
@.str.5 = [2 x i8] c"E\00"
@.str.6 = [2 x i8] c"F\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [200 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
store i32 2, i32* %5
br label %9
9: ; preds = %57, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = sdiv i32 %11, 2
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %60
14: ; preds = %9
%15 = load i32, i32* %2
store i32 %15, i32* %6
store i32 0, i32* %3
br label %16
16: ; preds = %25, %14
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load i32, i32* %6
%21 = srem i32 %20, 16
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %19
%26 = load i32, i32* %6
%27 = sdiv i32 %26, 16
store i32 %27, i32* %6
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %16
30: ; preds = %16
%31 = load i32, i32* %3
store i32 %31, i32* %5
%32 = load i32, i32* %5
%33 = sub nsw i32 %32, 1
store i32 %33, i32* %7
store i32 0, i32* %3
br label %34
34: ; preds = %51, %30
%35 = load i32, i32* %3
%36 = load i32, i32* %5
%37 = sdiv i32 %36, 2
%38 = icmp slt i32 %35, %37
br i1 %38, label %39, label %56
39: ; preds = %34
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp ne i32 %43, %47
br i1 %48, label %49, label %50
49: ; preds = %39
br label %56
50: ; preds = %39
br label %51
51: ; preds = %50
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
%54 = load i32, i32* %7
%55 = add nsw i32 %54, -1
store i32 %55, i32* %7
br label %34
56: ; preds = %49, %34
br label %57
57: ; preds = %56
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %9
60: ; preds = %9
store i32 0, i32* %3
br label %61
61: ; preds = %89, %60
%62 = load i32, i32* %3
%63 = load i32, i32* %5
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %92
65: ; preds = %61
%66 = load i32, i32* %3
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 %67
%69 = load i32, i32* %68
switch i32 %69, label %82 [
i32 10, label %70
i32 11, label %72
i32 12, label %74
i32 13, label %76
i32 14, label %78
i32 15, label %80
]
70: ; preds = %65
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %88
72: ; preds = %65
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %88
74: ; preds = %65
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %88
76: ; preds = %65
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %88
78: ; preds = %65
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %88
80: ; preds = %65
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %88
82: ; preds = %65
%83 = load i32, i32* %3
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [200 x i32], [200 x i32]* %4, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %82, %80, %78, %76, %74, %72, %70
br label %89
89: ; preds = %88
%90 = load i32, i32* %3
%91 = add nsw i32 %90, 1
store i32 %91, i32* %3
br label %61
92: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i32]
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = bitcast [200 x i32]* %2 to i8*
%6 = load i32, i32* %1
br label %12
7: ; preds = %45
%8 = trunc i64 %29 to i32
store i32 %47, i32* %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %70, label %10
10: ; preds = %7
%11 = and i64 %29, 4294967295
br label %49
12: ; preds = %0, %45
%13 = phi i32 [ %6, %0 ], [ %47, %45 ]
%14 = icmp sgt i32 %13, 0
br i1 %14, label %23, label %70
15: ; preds = %23
%16 = trunc i64 %29 to i32
%17 = lshr i32 %16, 1
%18 = icmp ult i32 %16, 2
br i1 %18, label %45, label %19
19: ; preds = %15
%20 = and i64 %29, 4294967295
%21 = call i32 @llvm.umax.i32(i32 %17, i32 1)
%22 = zext i32 %21 to i64
br label %31
23: ; preds = %12, %23
%24 = phi i64 [ %29, %23 ], [ 0, %12 ]
%25 = phi i32 [ %28, %23 ], [ %13, %12 ]
%26 = and i32 %25, 15
%27 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 %24
store i32 %26, i32* %27
%28 = lshr i32 %25, 4
%29 = add nuw nsw i64 %24, 1
%30 = icmp ult i32 %25, 16
br i1 %30, label %15, label %23
31: ; preds = %19, %40
%32 = phi i64 [ 0, %19 ], [ %41, %40 ]
%33 = phi i64 [ %20, %19 ], [ %34, %40 ]
%34 = add nsw i64 %33, -1
%35 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 %32
%36 = load i32, i32* %35
%37 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 %34
%38 = load i32, i32* %37
%39 = icmp eq i32 %36, %38
br i1 %39, label %40, label %43
40: ; preds = %31
%41 = add nuw nsw i64 %32, 1
%42 = icmp eq i64 %41, %22
br i1 %42, label %45, label %31
43: ; preds = %31
%44 = trunc i64 %32 to i32
br label %45
45: ; preds = %40, %43, %15
%46 = phi i32 [ 0, %15 ], [ %44, %43 ], [ %21, %40 ]
%47 = add nsw i32 %13, 1
%48 = icmp eq i32 %46, %17
br i1 %48, label %7, label %12
49: ; preds = %10, %67
%50 = phi i64 [ 0, %10 ], [ %68, %67 ]
%51 = getelementptr inbounds [200 x i32], [200 x i32]* %2, i64 0, i64 %50
%52 = load i32, i32* %51
switch i32 %52, label %65 [
i32 10, label %53
i32 11, label %55
i32 12, label %57
i32 13, label %59
i32 14, label %61
i32 15, label %63
]
53: ; preds = %49
%54 = call i32 @putchar(i32 65)
br label %67
55: ; preds = %49
%56 = call i32 @putchar(i32 66)
br label %67
57: ; preds = %49
%58 = call i32 @putchar(i32 67)
br label %67
59: ; preds = %49
%60 = call i32 @putchar(i32 68)
br label %67
61: ; preds = %49
%62 = call i32 @putchar(i32 69)
br label %67
63: ; preds = %49
%64 = call i32 @putchar(i32 70)
br label %67
65: ; preds = %49
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %52)
br label %67
67: ; preds = %53, %55, %57, %59, %61, %63, %65
%68 = add nuw nsw i64 %50, 1
%69 = icmp eq i64 %68, %11
br i1 %69, label %70, label %49
70: ; preds = %12, %67, %7
ret i32 0
}