#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 input;
  int count = 0, hex[10], i, rev, temp;
  scanf("%d", &input);
  for (; count != i / 2; input++) {
    temp = input;
    for (count = 0; temp > 0; count++) {
      hex[count] = temp % 16;
      temp /= 16;
    }
    i = count;
    rev = i - 1;
    for (count = 0; count < i / 2; count++, rev--) {
      if (hex[count] != hex[rev]) {
        break;
      }
    }
  }
  for (count = 0; count < i; count++) {
    switch (hex[count]) {
    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[count]);
      break;
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
cmp    %ecx,%eax
je     1228 <main+0x108>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jle    11aa <main+0x8a>
mov    -0x4c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
movslq -0xc(%rbp),%rax
mov    %edx,-0x40(%rbp,%rax,4)
mov    -0x4c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1171 <main+0x51>
mov    -0xc(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x48(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jge    1215 <main+0xf5>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
movslq -0x48(%rbp),%rcx
cmp    -0x40(%rbp,%rcx,4),%eax
je     11f9 <main+0xd9>
jmp    1215 <main+0xf5>
jmp    11fe <main+0xde>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x48(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x48(%rbp)
jmp    11c0 <main+0xa0>
jmp    121a <main+0xfa>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1304 <main+0x1e4>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0x60(%rbp)
sub    $0x5,%eax
ja     12db <main+0x1bb>
mov    -0x60(%rbp),%rax
lea    0xda0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f1 <main+0x1d1>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f1 <main+0x1d1>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f1 <main+0x1d1>
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f1 <main+0x1d1>
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f1 <main+0x1d1>
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f1 <main+0x1d1>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f6 <main+0x1d6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    122f <main+0x10f>
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
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"
@.str.7 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
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* %7
store i32 0, i32* %3
br label %16
16: ; preds = %27, %14
%17 = load i32, i32* %7
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load i32, i32* %7
%21 = srem i32 %20, 16
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %23
store i32 %21, i32* %24
%25 = load i32, i32* %7
%26 = sdiv i32 %25, 16
store i32 %26, i32* %7
br label %27
27: ; preds = %19
%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* %6
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 [10 x i32], [10 x i32]* %4, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [10 x i32], [10 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* %6
%55 = add nsw i32 %54, -1
store i32 %55, i32* %6
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 [10 x i32], [10 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 [10 x i32], [10 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
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%94 = load i32, i32* %1
ret i32 %94
}

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 = call i32 @putchar(i32 10)
ret i32 0
}