#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 reverse(int);
int reverseDigits(int);
int main(int argc, char **argv) {
  int x = 123;
  printf("sizeof(int)   = %d\n", sizeof(int));
  printf("sizeof(short) = %d\n", sizeof(short));
  printf("%d, %d\n", x, reverse(x));
  printf("%d, %d\n", x, reverseDigits(x));
  x = -123;
  printf("%d, %d\n", x, reverse(x));
  printf("%d, %d\n", x, reverseDigits(x));
  x = -123456789;
  printf("%d, %d\n", x, reverse(x));
  printf("%d, %d\n", x, reverseDigits(x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7b,-0x14(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <reverse@plt>
mov    -0x2c(%rbp),%esi
mov    %eax,%edx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <reverseDigits@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffff85,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <reverse@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <reverseDigits@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xf8a432eb,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <reverse@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <reverseDigits@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7b,%edi
call   1030 <reverse@plt>
lea    0xec0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7b,%edi
call   1040 <reverseDigits@plt>
mov    %rbx,%rdi
mov    $0x7b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffff85,%edi
call   1030 <reverse@plt>
mov    %rbx,%rdi
mov    $0xffffff85,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffff85,%edi
call   1040 <reverseDigits@plt>
mov    %rbx,%rdi
mov    $0xffffff85,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf8a432eb,%edi
call   1030 <reverse@plt>
mov    %rbx,%rdi
mov    $0xf8a432eb,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xf8a432eb,%edi
call   1040 <reverseDigits@plt>
mov    %rbx,%rdi
mov    $0xf8a432eb,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"sizeof(int) = %d\0A\00"
@.str.1 = [20 x i8] c"sizeof(short) = %d\0A\00"
@.str.2 = [8 x i8] c"%d, %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 123, i32* %6
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 4)
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 2)
%9 = load i32, i32* %6
%10 = load i32, i32* %6
%11 = call i32 @reverse(i32 %10)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %11)
%13 = load i32, i32* %6
%14 = load i32, i32* %6
%15 = call i32 @reverseDigits(i32 %14)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %15)
store i32 -123, i32* %6
%17 = load i32, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @reverse(i32 %18)
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %19)
%21 = load i32, i32* %6
%22 = load i32, i32* %6
%23 = call i32 @reverseDigits(i32 %22)
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %23)
store i32 -123456789, i32* %6
%25 = load i32, i32* %6
%26 = load i32, i32* %6
%27 = call i32 @reverse(i32 %26)
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %6
%31 = call i32 @reverseDigits(i32 %30)
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"sizeof(int) = %d\0A\00"
@.str.1 = [20 x i8] c"sizeof(short) = %d\0A\00"
@.str.2 = [8 x i8] c"%d, %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 2)
%5 = tail call i32 @reverse(i32 123)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 123, i32 %5)
%7 = tail call i32 @reverseDigits(i32 123)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 123, i32 %7)
%9 = tail call i32 @reverse(i32 -123)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 -123, i32 %9)
%11 = tail call i32 @reverseDigits(i32 -123)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 -123, i32 %11)
%13 = tail call i32 @reverse(i32 -123456789)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 -123456789, i32 %13)
%15 = tail call i32 @reverseDigits(i32 -123456789)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 -123456789, i32 %15)
ret i32 0
}