#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 */
double pow(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, c, d = 10, e, f, g, h = 0, i, j = 0, k, l;
  double m, n;
  scanf("%d", &a);
  l = a;
  for (c = 100; c >= 1;) {
    c = a / d;
    d = d * 10;
    h = h + 1;
  }
  k = h;
  for (i = 1; i <= h; i = i + 1) {
    b = a % 10;
    a = a - b;
    a = a / 10;
    m = pow(b, k);
    j = j + m;
    k = k - 1;
  }
  printf("Reverse of %d is %d", l, j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
movl   $0x64,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jl     119a <main+0x6a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x10(%rbp)
imul   $0xa,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1171 <main+0x41>
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1210 <main+0xe0>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1050 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a7 <main+0x77>
mov    -0x34(%rbp),%esi
mov    -0x2c(%rbp),%edx
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xa,%ecx
xor    %ebp,%ebp
mov    0x4(%rsp),%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%eax
cltd
idiv   %ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
add    $0xffffffff,%ebp
test   %eax,%eax
jg     1160 <main+0x30>
movslq %r14d,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %r14d,%edi
sub    %ecx,%edi
mov    %eax,0x4(%rsp)
mov    %ebp,%esi
neg    %esi
call   1050 <pow@plt>
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%r15d
cmp    $0xffffffff,%ebp
je     1205 <main+0xd5>
mov    $0xfffffffe,%ebx
sub    %ebp,%ebx
not    %ebp
nopl   0x0(%rax)
movslq 0x4(%rsp),%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
mov    %eax,0x4(%rsp)
mov    %ebp,%esi
call   1050 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %r15d,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%r15d
add    $0xffffffff,%ebp
add    $0xffffffff,%ebx
jb     11c0 <main+0x90>
lea    0xdf4(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
store i32 0, i32* %1
store i32 10, i32* %5
store i32 0, i32* %9
store i32 0, i32* %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
store i32 %17, i32* %13
store i32 100, i32* %4
br label %18
18: ; preds = %21, %0
%19 = load i32, i32* %4
%20 = icmp sge i32 %19, 1
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %2
%23 = load i32, i32* %5
%24 = sdiv i32 %22, %23
store i32 %24, i32* %4
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, 10
store i32 %26, i32* %5
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
br label %18
29: ; preds = %18
%30 = load i32, i32* %9
store i32 %30, i32* %12
store i32 1, i32* %10
br label %31
31: ; preds = %53, %29
%32 = load i32, i32* %10
%33 = load i32, i32* %9
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %56
35: ; preds = %31
%36 = load i32, i32* %2
%37 = srem i32 %36, 10
store i32 %37, i32* %3
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = sub nsw i32 %38, %39
store i32 %40, i32* %2
%41 = load i32, i32* %2
%42 = sdiv i32 %41, 10
store i32 %42, i32* %2
%43 = load i32, i32* %3
%44 = load i32, i32* %12
%45 = call double @pow(i32 %43, i32 %44)
store double %45, double* %14
%46 = load i32, i32* %11
%47 = sitofp i32 %46 to double
%48 = load double, double* %14
%49 = fadd double %47, %48
%50 = fptosi double %49 to i32
store i32 %50, i32* %11
%51 = load i32, i32* %12
%52 = sub nsw i32 %51, 1
store i32 %52, i32* %12
br label %53
53: ; preds = %35
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
store i32 %55, i32* %10
br label %31
56: ; preds = %31
%57 = load i32, i32* %13
%58 = load i32, i32* %11
%59 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %57, i32 %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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
br label %12
5: ; preds = %12
%6 = srem i32 %4, 10
%7 = sdiv i32 %4, 10
store i32 %7, i32* %1
%8 = call double @pow(i32 %6, i32 %17)
%9 = fadd double %8, 0.000000e+00
%10 = fptosi double %9 to i32
%11 = icmp eq i32 %14, 0
br i1 %11, label %33, label %19
12: ; preds = %0, %12
%13 = phi i32 [ 10, %0 ], [ %16, %12 ]
%14 = phi i32 [ 0, %0 ], [ %17, %12 ]
%15 = sdiv i32 %4, %13
%16 = mul nsw i32 %13, 10
%17 = add nuw nsw i32 %14, 1
%18 = icmp sgt i32 %15, 0
br i1 %18, label %12, label %5
19: ; preds = %5, %19
%20 = phi i32 [ %31, %19 ], [ %10, %5 ]
%21 = phi i32 [ %23, %19 ], [ 1, %5 ]
%22 = phi i32 [ %24, %19 ], [ %17, %5 ]
%23 = add nuw i32 %21, 1
%24 = add nsw i32 %22, -1
%25 = load i32, i32* %1
%26 = srem i32 %25, 10
%27 = sdiv i32 %25, 10
store i32 %27, i32* %1
%28 = call double @pow(i32 %26, i32 %24)
%29 = sitofp i32 %20 to double
%30 = fadd double %28, %29
%31 = fptosi double %30 to i32
%32 = icmp eq i32 %21, %14
br i1 %32, label %33, label %19
33: ; preds = %19, %5
%34 = phi i32 [ %10, %5 ], [ %31, %19 ]
%35 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %34)
ret i32 0
}