#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, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, c = 0, e;
  scanf("%d", &a);
  printf("%d ", a);
  while (a) {
    b = a % 10;
    c = c * 10 + b;
    a = a / 10;
  }
  printf("Reverse of %d is %d", e, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     118c <main+0x6c>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
imul   $0xa,-0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1157 <main+0x37>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xebf(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1193 <main+0x73>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rbx,%rbx,4),%ecx
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,%edi
sub    %esi,%edi
lea    (%rdi,%rcx,2),%ebx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1160 <main+0x40>
mov    %eax,0xc(%rsp)
lea    0xe6a(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [20 x i8] c"Reverse of %d is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %12, %0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %2
%14 = srem i32 %13, 10
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = mul nsw i32 %15, 10
%17 = load i32, i32* %3
%18 = add nsw i32 %16, %17
store i32 %18, i32* %4
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 10
store i32 %20, i32* %2
br label %9
21: ; preds = %9
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [20 x i8] c"Reverse of %d is %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 = load i32, i32* %1
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %0, %8
%9 = phi i32 [ %13, %8 ], [ 0, %0 ]
%10 = phi i32 [ %14, %8 ], [ %6, %0 ]
%11 = srem i32 %10, 10
%12 = mul nsw i32 %9, 10
%13 = add nsw i32 %12, %11
%14 = sdiv i32 %10, 10
%15 = add i32 %10, 9
%16 = icmp ult i32 %15, 19
br i1 %16, label %17, label %8
17: ; preds = %8
store i32 %14, i32* %1
br label %18
18: ; preds = %17, %0
%19 = phi i32 [ %13, %17 ], [ 0, %0 ]
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 undef, i32 %19)
ret i32 0
}