#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 */
long long pow(int, long long);
long long int reverse_number(long int number) {
  long long int temp = 0, power = 0, cnt = 0, orignal = number;
  long long int reverse = 0;
  while (orignal > 0) {
    orignal = orignal / 10;
    cnt++;
  }
  power = pow(10, cnt - 1);
  while (number > 0) {
    temp = number % 10;
    temp *= power;
    reverse += temp;
    power /= 10;
    number /= 10;
  }
  return reverse;
}


x86 assembly (clang, -O0):
<reverse_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
jle    1172 <reverse_number+0x62>
mov    -0x28(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1144 <reverse_number+0x34>
mov    -0x20(%rbp),%rsi
sub    $0x1,%rsi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jle    11e7 <reverse_number+0xd7>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x10(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    1188 <reverse_number+0x78>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_number>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
jle    11c4 <reverse_number+0xb4>
mov    %rdi,%rbx
mov    $0xffffffffffffffff,%rsi
movabs $0xcccccccccccccccd,%r14
cc cc cc
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rcx,%rax
mul    %r14
shr    $0x3,%rdx
add    $0x1,%rsi
cmp    $0x9,%rcx
mov    %rdx,%rcx
ja     1140 <reverse_number+0x30>
mov    $0xa,%edi
call   1030 <pow@plt>
test   %rbx,%rbx
jle    11d5 <reverse_number+0xc5>
mov    %rax,%rsi
xor    %ecx,%ecx
movabs $0x6666666666666667,%r8
66 66 66
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rax
mul    %r14
mov    %rdx,%rdi
shr    $0x3,%rdi
lea    (%rdi,%rdi,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rbx,%rdx
sub    %rax,%rdx
imul   %rsi,%rdx
add    %rdx,%rcx
mov    %rsi,%rax
imul   %r8
mov    %rdx,%rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rsi
add    %rax,%rsi
cmp    $0x9,%rbx
mov    %rdi,%rbx
ja     1180 <reverse_number+0x70>
jmp    11d7 <reverse_number+0xc7>
mov    $0xa,%edi
mov    $0xffffffffffffffff,%rsi
call   1030 <pow@plt>
xor    %ecx,%ecx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @reverse_number(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
store i64 0, i64* %5
%8 = load i64, i64* %2
store i64 %8, i64* %6
store i64 0, i64* %7
br label %9
9: ; preds = %12, %1
%10 = load i64, i64* %6
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i64, i64* %6
%14 = sdiv i64 %13, 10
store i64 %14, i64* %6
%15 = load i64, i64* %5
%16 = add nsw i64 %15, 1
store i64 %16, i64* %5
br label %9
17: ; preds = %9
%18 = load i64, i64* %5
%19 = sub nsw i64 %18, 1
%20 = call i64 @pow(i32 10, i64 %19)
store i64 %20, i64* %4
br label %21
21: ; preds = %24, %17
%22 = load i64, i64* %2
%23 = icmp sgt i64 %22, 0
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = load i64, i64* %2
%26 = srem i64 %25, 10
store i64 %26, i64* %3
%27 = load i64, i64* %4
%28 = load i64, i64* %3
%29 = mul nsw i64 %28, %27
store i64 %29, i64* %3
%30 = load i64, i64* %3
%31 = load i64, i64* %7
%32 = add nsw i64 %31, %30
store i64 %32, i64* %7
%33 = load i64, i64* %4
%34 = sdiv i64 %33, 10
store i64 %34, i64* %4
%35 = load i64, i64* %2
%36 = sdiv i64 %35, 10
store i64 %36, i64* %2
br label %21
37: ; preds = %21
%38 = load i64, i64* %7
ret i64 %38
}

LLVM IR (-O2):
define i64 @reverse_number(i64 %0) {
%2 = icmp sgt i64 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i64 @pow(i32 10, i64 -1)
br label %23
5: ; preds = %1, %5
%6 = phi i64 [ %8, %5 ], [ %0, %1 ]
%7 = phi i64 [ %9, %5 ], [ 0, %1 ]
%8 = udiv i64 %6, 10
%9 = add nuw nsw i64 %7, 1
%10 = icmp ult i64 %6, 10
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = tail call i64 @pow(i32 10, i64 %7)
br i1 %2, label %13, label %23
13: ; preds = %11, %13
%14 = phi i64 [ %19, %13 ], [ 0, %11 ]
%15 = phi i64 [ %20, %13 ], [ %12, %11 ]
%16 = phi i64 [ %21, %13 ], [ %0, %11 ]
%17 = urem i64 %16, 10
%18 = mul nsw i64 %17, %15
%19 = add nsw i64 %14, %18
%20 = sdiv i64 %15, 10
%21 = udiv i64 %16, 10
%22 = icmp ult i64 %16, 10
br i1 %22, label %23, label %13
23: ; preds = %13, %3, %11
%24 = phi i64 [ 0, %11 ], [ 0, %3 ], [ %19, %13 ]
ret i64 %24
}