#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 */
scalar_t__ pow(double, double);
int reverse(int num) {
  int inv = 0;
  int dig = 0;
  for (int i = 2; i >= 0; i--) {
    dig = num / (int)pow(10.0, (double)i);
    num -= dig * (int)pow(10.0, (double)i);
    inv += dig * (int)pow(10.0, (double)(2 - i));
  }
  return inv;
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11c0 <reverse+0xb0>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xeb3(%rip),%xmm0
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x1c(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe8f(%rip),%xmm0
call   1030 <pow@plt>
mov    -0x18(%rbp),%ecx
imul   %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%eax
sub    -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe62(%rip),%xmm0
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <reverse+0x20>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
movsd  0xedf(%rip),%xmm0
movsd  0xedf(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
movsd  0xec0(%rip),%xmm0
movsd  0xec0(%rip),%xmm1
call   1030 <pow@plt>
imul   %ebx,%eax
sub    %eax,%ebp
xorps  %xmm1,%xmm1
movsd  0xea3(%rip),%xmm0
call   1030 <pow@plt>
mov    %rax,%r14
imul   %ebx,%r14d
movsd  0xe9f(%rip),%xmm1
movsd  0xe87(%rip),%xmm0
call   1030 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%r15d
movsd  0xe6f(%rip),%xmm0
movsd  0xe77(%rip),%xmm1
call   1030 <pow@plt>
imul   %r15d,%eax
sub    %eax,%ebp
movsd  0xe54(%rip),%xmm0
movsd  0xe5c(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rbx
imul   %r15d,%ebx
add    %r14d,%ebx
xorps  %xmm1,%xmm1
movsd  0xe32(%rip),%xmm0
call   1030 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%ebp
xorps  %xmm1,%xmm1
movsd  0xe18(%rip),%xmm0
call   1030 <pow@plt>
movsd  0xe0b(%rip),%xmm0
movsd  0xe0b(%rip),%xmm1
call   1030 <pow@plt>
imul   %ebp,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @reverse(i32 %0) {
%2 = tail call i64 @pow(double 1.000000e+01, double 2.000000e+00)
%3 = trunc i64 %2 to i32
%4 = sdiv i32 %0, %3
%5 = tail call i64 @pow(double 1.000000e+01, double 2.000000e+00)
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %4, %6
%8 = sub nsw i32 %0, %7
%9 = tail call i64 @pow(double 1.000000e+01, double 0.000000e+00)
%10 = trunc i64 %9 to i32
%11 = mul nsw i32 %4, %10
%12 = tail call i64 @pow(double 1.000000e+01, double 1.000000e+00)
%13 = trunc i64 %12 to i32
%14 = sdiv i32 %8, %13
%15 = tail call i64 @pow(double 1.000000e+01, double 1.000000e+00)
%16 = trunc i64 %15 to i32
%17 = mul nsw i32 %14, %16
%18 = sub nsw i32 %8, %17
%19 = tail call i64 @pow(double 1.000000e+01, double 1.000000e+00)
%20 = trunc i64 %19 to i32
%21 = mul nsw i32 %14, %20
%22 = add nsw i32 %21, %11
%23 = tail call i64 @pow(double 1.000000e+01, double 0.000000e+00)
%24 = trunc i64 %23 to i32
%25 = sdiv i32 %18, %24
%26 = tail call i64 @pow(double 1.000000e+01, double 0.000000e+00)
%27 = tail call i64 @pow(double 1.000000e+01, double 2.000000e+00)
%28 = trunc i64 %27 to i32
%29 = mul nsw i32 %25, %28
%30 = add nsw i32 %29, %22
ret i32 %30
}