#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 INT_MAX;
int INT_MIN;
int abs_val(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  printf("Abs %d -> %u\n", 0, abs_val(0));
  printf("Abs %d -> %u\n", 1, abs_val(1));
  printf("Abs %d -> %u\n", -1, abs_val(-1));
  printf("Abs %d -> %u\n", 42, abs_val(42));
  printf("Abs %d -> %u\n", -10000, abs_val(-10000));
  printf("Abs %d -> %u\n", INT_MAX, abs_val(INT_MAX));
  printf("Abs %d -> %u\n", INT_MIN, abs_val(INT_MIN));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <abs_val@plt>
mov    %eax,%edx
lea    0xec1(%rip),%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <abs_val@plt>
mov    %eax,%edx
lea    0xea7(%rip),%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1030 <abs_val@plt>
mov    %eax,%edx
lea    0xe8a(%rip),%rdi
mov    $0xffffffff,%esi
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <abs_val@plt>
mov    %eax,%edx
lea    0xe6d(%rip),%rdi
mov    $0x2a,%esi
call   1040 <printf@plt>
mov    $0xffffd8f0,%edi
call   1030 <abs_val@plt>
mov    %eax,%edx
lea    0xe50(%rip),%rdi
mov    $0xffffd8f0,%esi
call   1040 <printf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1030 <abs_val@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
call   1030 <abs_val@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xdf5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <abs_val@plt>
lea    0xecf(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <abs_val@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1030 <abs_val@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <abs_val@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xffffd8f0,%edi
call   1030 <abs_val@plt>
mov    %rbx,%rdi
mov    $0xffffd8f0,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1030 <abs_val@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1030 <abs_val@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Abs %d -> %u\0A\00"
@INT_MAX = global i32 0
@INT_MIN = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @abs_val(i32 0)
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0, i32 %2)
%4 = call i32 @abs_val(i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4)
%6 = call i32 @abs_val(i32 -1)
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 -1, i32 %6)
%8 = call i32 @abs_val(i32 42)
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 42, i32 %8)
%10 = call i32 @abs_val(i32 -10000)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 -10000, i32 %10)
%12 = load i32, i32* @INT_MAX
%13 = load i32, i32* @INT_MAX
%14 = call i32 @abs_val(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14)
%16 = load i32, i32* @INT_MIN
%17 = load i32, i32* @INT_MIN
%18 = call i32 @abs_val(i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Abs %d -> %u\0A\00"
@INT_MAX = global i32 0
@INT_MIN = global i32 0
define i32 @main() {
%1 = tail call i32 @abs_val(i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0, i32 %1)
%3 = tail call i32 @abs_val(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1, i32 %3)
%5 = tail call i32 @abs_val(i32 -1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 -1, i32 %5)
%7 = tail call i32 @abs_val(i32 42)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 42, i32 %7)
%9 = tail call i32 @abs_val(i32 -10000)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 -10000, i32 %9)
%11 = load i32, i32* @INT_MAX
%12 = tail call i32 @abs_val(i32 %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = load i32, i32* @INT_MIN
%15 = tail call i32 @abs_val(i32 %14)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
ret i32 0
}