#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(void) {
  int number, digit, rebmun = 0;
  printf("Enter your number to reverse: ");
  scanf("%i", &number);
  if (0 > number) {
    printf("negative ");
    number *= -1;
  }
  do {
    rebmun += number % 10;
    rebmun *= 10;
    number /= 10;
  } while (number);
  rebmun /= 10;
  do {
    digit = rebmun % 10;
    rebmun /= 10;
    switch (digit) {
    case 0:
      printf("zero ");
      break;
    case 1:
      printf("one ");
      break;
    case 2:
      printf("two ");
      break;
    case 3:
      printf("three ");
      break;
    case 4:
      printf("four ");
      break;
    case 5:
      printf("five ");
      break;
    case 6:
      printf("six ");
      break;
    case 7:
      printf("seven ");
      break;
    case 8:
      printf("eight ");
      break;
    case 9:
      printf("nine ");
      break;
    default:
      break;
    }
  } while (rebmun);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jle    1170 <main+0x50>
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x55>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%edx
mov    %edx,-0x10(%rbp)
imul   $0xa,-0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1175 <main+0x55>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
movslq -0x10(%rbp),%rcx
mov    %ecx,%eax
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdx
add    %ecx,%edx
add    %edx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
movslq -0x10(%rbp),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x9,%rax
ja     12c3 <main+0x1a3>
mov    -0x18(%rbp),%rax
lea    0xdf0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xe07(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xde5(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xddb(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
lea    0xdd1(%rip),%rdi
call   1030 <printf@plt>
jmp    12c8 <main+0x1a8>
jmp    12c8 <main+0x1a8>
jmp    12cd <main+0x1ad>
cmpl   $0x0,-0x10(%rbp)
jne    11b3 <main+0x93>
lea    0xdb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jns    1170 <main+0x40>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
sub    0xc(%rsp),%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%ebx
sub    %esi,%ebx
add    %ecx,%ebx
lea    (%rbx,%rbx,1),%ecx
lea    (%rcx,%rcx,4),%ecx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1180 <main+0x50>
mov    %eax,0xc(%rsp)
lea    0xeac(%rip),%r14
jmp    11cb <main+0x9b>
xchg   %ax,%ax
add    $0x9,%ebx
cmp    $0x12,%ebx
mov    %r15d,%ebx
jbe    1201 <main+0xd1>
movslq %ebx,%rax
imul   $0x66666667,%rax,%r15
mov    %r15,%rcx
shr    $0x3f,%rcx
sar    $0x22,%r15
add    %ecx,%r15d
lea    (%r15,%r15,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cmp    $0x9,%eax
ja     11c0 <main+0x90>
cltq
movslq (%r14,%rax,4),%rdi
add    %r14,%rdi
call   1040 <printf@plt>
jmp    11c0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter your number to reverse: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [10 x i8] c"negative \00"
@.str.3 = [6 x i8] c"zero \00"
@.str.4 = [5 x i8] c"one \00"
@.str.5 = [5 x i8] c"two \00"
@.str.6 = [7 x i8] c"three \00"
@.str.7 = [6 x i8] c"four \00"
@.str.8 = [6 x i8] c"five \00"
@.str.9 = [5 x i8] c"six \00"
@.str.10 = [7 x i8] c"seven \00"
@.str.11 = [7 x i8] c"eight \00"
@.str.12 = [6 x i8] c"nine \00"
@.str.13 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 0, %7
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = mul nsw i32 %11, -1
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %0
br label %14
14: ; preds = %23, %13
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
%17 = load i32, i32* %4
%18 = add nsw i32 %17, %16
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = mul nsw i32 %19, 10
store i32 %20, i32* %4
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
store i32 %22, i32* %2
br label %23
23: ; preds = %14
%24 = load i32, i32* %2
%25 = icmp ne i32 %24, 0
br i1 %25, label %14, label %26
26: ; preds = %23
%27 = load i32, i32* %4
%28 = sdiv i32 %27, 10
store i32 %28, i32* %4
br label %29
29: ; preds = %57, %26
%30 = load i32, i32* %4
%31 = srem i32 %30, 10
store i32 %31, i32* %3
%32 = load i32, i32* %4
%33 = sdiv i32 %32, 10
store i32 %33, i32* %4
%34 = load i32, i32* %3
switch i32 %34, label %55 [
i32 0, label %35
i32 1, label %37
i32 2, label %39
i32 3, label %41
i32 4, label %43
i32 5, label %45
i32 6, label %47
i32 7, label %49
i32 8, label %51
i32 9, label %53
]
35: ; preds = %29
%36 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %56
37: ; preds = %29
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %56
39: ; preds = %29
%40 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %56
41: ; preds = %29
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %56
43: ; preds = %29
%44 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %56
45: ; preds = %29
%46 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %56
47: ; preds = %29
%48 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %56
49: ; preds = %29
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %56
51: ; preds = %29
%52 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %56
53: ; preds = %29
%54 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
br label %56
55: ; preds = %29
br label %56
56: ; preds = %55, %53, %51, %49, %47, %45, %43, %41, %39, %37, %35
br label %57
57: ; preds = %56
%58 = load i32, i32* %4
%59 = icmp ne i32 %58, 0
br i1 %59, label %29, label %60
60: ; preds = %57
%61 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter your number to reverse: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [10 x i8] c"negative \00"
@.str.3 = [6 x i8] c"zero \00"
@.str.4 = [5 x i8] c"one \00"
@.str.5 = [5 x i8] c"two \00"
@.str.6 = [7 x i8] c"three \00"
@.str.7 = [6 x i8] c"four \00"
@.str.8 = [6 x i8] c"five \00"
@.str.9 = [5 x i8] c"six \00"
@.str.10 = [7 x i8] c"seven \00"
@.str.11 = [7 x i8] c"eight \00"
@.str.12 = [6 x i8] c"nine \00"
@reltable.main = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.10 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.11 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.12 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = sub nsw i32 0, %9
br label %11
11: ; preds = %7, %0
%12 = phi i32 [ %5, %0 ], [ %10, %7 ]
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ %19, %13 ], [ %12, %11 ]
%15 = phi i32 [ %18, %13 ], [ 0, %11 ]
%16 = srem i32 %14, 10
%17 = add nsw i32 %16, %15
%18 = mul nsw i32 %17, 10
%19 = sdiv i32 %14, 10
%20 = add i32 %14, 9
%21 = icmp ult i32 %20, 19
br i1 %21, label %22, label %13
22: ; preds = %13
store i32 %19, i32* %1
br label %23
23: ; preds = %22, %33
%24 = phi i32 [ %26, %33 ], [ %17, %22 ]
%25 = srem i32 %24, 10
%26 = sdiv i32 %24, 10
%27 = icmp ult i32 %25, 10
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = sext i32 %25 to i64
%30 = shl i64 %29, 2
%31 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.main to i8*), i64 %30)
%32 = call i32 @printf(i8* dereferenceable(1) %31)
br label %33
33: ; preds = %23, %28
%34 = add i32 %24, 9
%35 = icmp ult i32 %34, 19
br i1 %35, label %36, label %23
36: ; preds = %33
%37 = call i32 @putchar(i32 10)
ret i32 0
}