#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 *, long, int);
int reverse2(long);
int main() {
  int x1 = 3, x2 = -123;
  long x3 = 12345678912;
  printf("x1 = %d, reverse=%d\n", x1, reverse2(x1));
  printf("x2 = %d, reverse=%d\n", x2, reverse2(x2));
  printf("x3 = %ld, reverse=%d\n", x3, reverse2(x3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0xffffff85,-0xc(%rbp)
movabs $0x2dfdc1c40,%rax
mov    %rax,-0x18(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movslq -0x8(%rbp),%rdi
call   1030 <reverse2@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
movslq -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0xc(%rbp),%rdi
call   1030 <reverse2@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <reverse2@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3,%edi
call   1030 <reverse2@plt>
lea    0xece(%rip),%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xffffffffffffff85,%rdi
call   1030 <reverse2@plt>
lea    0xec4(%rip),%rdi
mov    $0xffffffffffffff85,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
movabs $0x2dfdc1c40,%rbx
mov    %rbx,%rdi
call   1030 <reverse2@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"x1 = %d, reverse=%d\0A\00"
@.str.1 = [21 x i8] c"x2 = %d, reverse=%d\0A\00"
@.str.2 = [22 x i8] c"x3 = %ld, reverse=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
store i32 3, i32* %2
store i32 -123, i32* %3
store i64 12345678912, i64* %4
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = call i32 @reverse2(i64 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %6, i32 %9)
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = call i32 @reverse2(i64 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %12, i32 %15)
%17 = load i64, i64* %4
%18 = load i64, i64* %4
%19 = call i32 @reverse2(i64 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %17, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"x1 = %d, reverse=%d\0A\00"
@.str.1 = [21 x i8] c"x2 = %d, reverse=%d\0A\00"
@.str.2 = [22 x i8] c"x3 = %ld, reverse=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @reverse2(i64 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 3, i32 %1)
%3 = tail call i32 @reverse2(i64 -123)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 -123, i32 %3)
%5 = tail call i32 @reverse2(i64 12345678912)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 12345678912, i32 %5)
ret i32 0
}