#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*/ fill_from_stdin(int *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int value;
  if (argc < 2) {
    fill_from_stdin(&value);
  }
  if ((value & 0xff) != 0) {
    if (value >= 0x40) {
      write(1, "1", 1);
      if (value == 0x41) {
        write(1, "a", 1);
      } else if (value == 0x42) {
        write(1, "b", 1);
      } else if (value == 0x43) {
        write(1, "c", 1);
      } else if (value == 0x44) {
        write(1, "d", 1);
      } else {
        write(1, "e", 1);
      }
    } else {
      write(1, "2", 1);
    }
  } else if ((value & 0xff00) != 0) {
    if (value > 0x1000) {
      write(1, "3", 1);
    } else {
      write(1, "4", 1);
    }
  } else if ((value & 0xff0000) != 0) {
    if (value > 0xf0000) {
      write(1, "5", 1);
    } else {
      write(1, "6", 1);
    }
  }
  write(1, "\n", 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1149 <main+0x29>
lea    -0x14(%rbp),%rdi
call   1040 <fill_from_stdin@plt>
mov    -0x14(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     123e <main+0x11e>
cmpl   $0x40,-0x14(%rbp)
jl     1226 <main+0x106>
mov    $0x1,%edx
lea    0xe90(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
cmpl   $0x41,-0x14(%rbp)
jne    1199 <main+0x79>
mov    $0x1,%edx
lea    0xe75(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    1221 <main+0x101>
cmpl   $0x42,-0x14(%rbp)
jne    11bb <main+0x9b>
mov    $0x1,%edx
lea    0xe55(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    121c <main+0xfc>
cmpl   $0x43,-0x14(%rbp)
jne    11dd <main+0xbd>
mov    $0x1,%edx
lea    0xe35(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    1217 <main+0xf7>
cmpl   $0x44,-0x14(%rbp)
jne    11ff <main+0xdf>
mov    $0x1,%edx
lea    0xe15(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    1212 <main+0xf2>
mov    $0x1,%edx
lea    0xdff(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    1217 <main+0xf7>
jmp    121c <main+0xfc>
jmp    1221 <main+0x101>
jmp    1239 <main+0x119>
mov    $0x1,%edx
lea    0xdda(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    12e4 <main+0x1c4>
mov    -0x14(%rbp),%eax
and    $0xff00,%eax
cmp    $0x0,%eax
je     128c <main+0x16c>
cmpl   $0x1000,-0x14(%rbp)
jle    1274 <main+0x154>
mov    $0x1,%edx
lea    0xda6(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    1287 <main+0x167>
mov    $0x1,%edx
lea    0xd90(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    12df <main+0x1bf>
mov    -0x14(%rbp),%eax
and    $0xff0000,%eax
cmp    $0x0,%eax
je     12da <main+0x1ba>
cmpl   $0xf0000,-0x14(%rbp)
jle    12c2 <main+0x1a2>
mov    $0x1,%edx
lea    0xd5c(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    12d5 <main+0x1b5>
mov    $0x1,%edx
lea    0xd46(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    12da <main+0x1ba>
jmp    12df <main+0x1bf>
jmp    12e4 <main+0x1c4>
mov    $0x1,%edi
lea    0xd26(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     11d0 <main+0xb0>
lea    0x4(%rsp),%rdi
call   1040 <fill_from_stdin@plt>
mov    0x4(%rsp),%eax
test   %al,%al
je     1175 <main+0x55>
cmp    $0x40,%eax
jl     1191 <main+0x71>
lea    0xeb8(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    0x4(%rsp),%eax
add    $0xffffffbf,%eax
cmp    $0x4,%eax
jae    119a <main+0x7a>
cltq
lea    0xeac(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
jmp    11c1 <main+0xa1>
test   $0xff00,%eax
je     11a3 <main+0x83>
cmp    $0x1001,%eax
lea    0xe86(%rip),%rax
lea    0xe81(%rip),%rsi
jmp    11bd <main+0x9d>
lea    0xe74(%rip),%rsi
jmp    11c1 <main+0xa1>
lea    0xe69(%rip),%rsi
jmp    11c1 <main+0xa1>
test   $0xff0000,%eax
je     11d0 <main+0xb0>
cmp    $0xf0001,%eax
lea    0xe5c(%rip),%rax
lea    0xe57(%rip),%rsi
cmovge %rax,%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
lea    0xe3f(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\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"2\00"
@.str.7 = [2 x i8] c"3\00"
@.str.8 = [2 x i8] c"4\00"
@.str.9 = [2 x i8] c"5\00"
@.str.10 = [2 x i8] c"6\00"
@.str.11 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @fill_from_stdin(i32* %6)
br label %11
11: ; preds = %9, %2
%12 = load i32, i32* %6
%13 = and i32 %12, 255
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %48
15: ; preds = %11
%16 = load i32, i32* %6
%17 = icmp sge i32 %16, 64
br i1 %17, label %18, label %45
18: ; preds = %15
%19 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 65
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %44
24: ; preds = %18
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 66
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %43
29: ; preds = %24
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 67
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %42
34: ; preds = %29
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 68
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %41
39: ; preds = %34
%40 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %41
41: ; preds = %39, %37
br label %42
42: ; preds = %41, %32
br label %43
43: ; preds = %42, %27
br label %44
44: ; preds = %43, %22
br label %47
45: ; preds = %15
%46 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 1)
br label %47
47: ; preds = %45, %44
br label %74
48: ; preds = %11
%49 = load i32, i32* %6
%50 = and i32 %49, 65280
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %60
52: ; preds = %48
%53 = load i32, i32* %6
%54 = icmp sgt i32 %53, 4096
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
br label %59
57: ; preds = %52
%58 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 1)
br label %59
59: ; preds = %57, %55
br label %73
60: ; preds = %48
%61 = load i32, i32* %6
%62 = and i32 %61, 16711680
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %72
64: ; preds = %60
%65 = load i32, i32* %6
%66 = icmp sgt i32 %65, 983040
br i1 %66, label %67, label %69
67: ; preds = %64
%68 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 1)
br label %71
69: ; preds = %64
%70 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 1)
br label %71
71: ; preds = %69, %67
br label %72
72: ; preds = %71, %60
br label %73
73: ; preds = %72, %59
br label %74
74: ; preds = %73, %47
%75 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\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"2\00"
@.str.7 = [2 x i8] c"3\00"
@.str.8 = [2 x i8] c"4\00"
@.str.9 = [2 x i8] c"5\00"
@.str.10 = [2 x i8] c"6\00"
@.str.11 = [2 x i8] c"\0A\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %37
6: ; preds = %2
%7 = call i32 @fill_from_stdin(i32* %3)
%8 = load i32, i32* %3
%9 = and i32 %8, 255
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %6
%12 = icmp sgt i32 %8, 63
br i1 %12, label %13, label %34
13: ; preds = %11
%14 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%15 = load i32, i32* %3
%16 = add i32 %15, -65
%17 = icmp ult i32 %16, 4
br i1 %17, label %30, label %34
18: ; preds = %6
%19 = and i32 %8, 65280
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = icmp sgt i32 %8, 4096
%23 = select i1 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
br label %34
24: ; preds = %18
%25 = and i32 %8, 16711680
%26 = icmp eq i32 %25, 0
br i1 %26, label %37, label %27
27: ; preds = %24
%28 = icmp sgt i32 %8, 983040
%29 = select i1 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0)
br label %34
30: ; preds = %13
%31 = sext i32 %16 to i64
%32 = shl i64 %31, 2
%33 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %32)
br label %34
34: ; preds = %13, %30, %27, %21, %11
%35 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %11 ], [ %23, %21 ], [ %29, %27 ], [ %33, %30 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %13 ]
%36 = call i32 @write(i32 1, i8* %35, i32 1)
br label %37
37: ; preds = %34, %2, %24
%38 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i32 2)
ret i32 0
}