xunge/DecIR huggingface dataset:
int fifo_count(int *actuel, int nbValeurs) {
  int i;
  for (i = 0; i < nbValeurs; i++)
    if (actuel[i] == -1)
      return i;
  return nbValeurs;
}


x86 assembly (clang, -O0):
<fifo_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114e <fifo_count+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    113b <fifo_count+0x3b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <fifo_count+0x54>
jmp    1140 <fifo_count+0x40>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <fifo_count+0x12>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fifo_count>:
mov    %esi,%eax
test   %esi,%esi
jle    111f <fifo_count+0x1f>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpl   $0xffffffff,(%rdi,%rcx,4)
je     1120 <fifo_count+0x20>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <fifo_count+0x10>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fifo_count(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i32*, i32** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %26
20: ; preds = %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load i32, i32* %5
store i32 %25, i32* %3
br label %26
26: ; preds = %24, %18
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @fifo_count(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, -1
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %16, label %6
14: ; preds = %6
%15 = trunc i64 %7 to i32
br label %16
16: ; preds = %11, %14, %2
%17 = phi i32 [ %1, %2 ], [ %15, %14 ], [ %1, %11 ]
ret i32 %17
}
/* Variables and functions */
unsigned long long get_8bytes(unsigned char const *);
double unpack754(unsigned long long, int, int);
double get_double(const unsigned char *p) {
  unsigned long long ull = get_8bytes(p);
  return (unpack754((ull), 64, 11));
}


x86 assembly (clang, -O0):
<get_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_8bytes@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x40,%esi
mov    $0xb,%edx
call   1040 <unpack754@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_double>:
push   %rax
call   1030 <get_8bytes@plt>
mov    %rax,%rdi
mov    $0x40,%esi
mov    $0xb,%edx
pop    %rax
jmp    1040 <unpack754@plt>

LLVM IR (-O0):
define double @get_double(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @get_8bytes(i8* %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = call double @unpack754(i64 %6, i32 64, i32 11)
ret double %7
}

LLVM IR (-O2):
define double @get_double(i8* %0) {
%2 = tail call i64 @get_8bytes(i8* %0)
%3 = tail call double @unpack754(i64 %2, i32 64, i32 11)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int execlp(const char *file, const char *arg, ...) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<execlp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<execlp>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @execlp(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @execlp(i8* nocapture readnone %0, i8* nocapture readnone %1, ...) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void initialize_cuda_device_(int *myrank_f, int *ncuda_devices) {
  fprintf(stderr, "ERROR: GPU_MODE enabled without GPU/CUDA Support. To enable "
                  "GPU support, reconfigure with --with-cuda flag.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<initialize_cuda_device_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<initialize_cuda_device_>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [109 x i8] c"ERROR: GPU_MODE enabled without GPU/CUDA Support. To enable GPU support, reconfigure with --with-cuda flag.\0A\00"
define void @initialize_cuda_device_(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [109 x i8] c"ERROR: GPU_MODE enabled without GPU/CUDA Support. To enable GPU support, reconfigure with --with-cuda flag.\0A\00"
define void @initialize_cuda_device_(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
int fibo(int n) {
  if (n < 2)
    return 1;
  else
    return fibo(n - 2) + fibo(n - 1);
}


x86 assembly (clang, -O0):
<fibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1131 <fibo+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1154 <fibo+0x44>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibo@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibo@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jl     1145 <fibo+0x35>
mov    %edi,%ebx
add    $0x1,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fibo@plt>
add    %eax,%ebp
add    $0xffffffff,%ebx
cmp    $0x2,%ebx
ja     1130 <fibo+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fibo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 2
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 2
%10 = call i32 @fibo(i32 %9)
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = call i32 @fibo(i32 %12)
%14 = add nsw i32 %10, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @fibo(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -2
%7 = tail call i32 @fibo(i32 %6)
%8 = add nsw i32 %4, -1
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 3
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ Elf32_Word;

/* Variables and functions */
int /*<<< orphan*/ bswap_32(int /*<<< orphan*/);
Elf32_Word read_elf_word(Elf32_Word word, bool swap) {
  return swap ? bswap_32(word) : word;
}


x86 assembly (clang, -O0):
<read_elf_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1138 <read_elf_word+0x28>
mov    -0x4(%rbp),%edi
call   1030 <bswap_32@plt>
mov    %eax,-0xc(%rbp)
jmp    113e <read_elf_word+0x2e>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_elf_word>:
test   %esi,%esi
je     1119 <read_elf_word+0x9>
jmp    1030 <bswap_32@plt>
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @read_elf_word(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 @bswap_32(i32 %8)
br label %12
10: ; preds = %2
%11 = load i32, i32* %3
br label %12
12: ; preds = %10, %7
%13 = phi i32 [ %9, %7 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @read_elf_word(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @bswap_32(i32 %0)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ %0, %2 ]
ret i32 %7
}
/* Variables and functions */
int sum_proper_divisors(int);
int chkPerfection(int n) {
  int d = sum_proper_divisors(n);
  if (d < n) {
    return -1;
  }
  if (d > n) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<chkPerfection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sum_proper_divisors@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    113e <chkPerfection+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <chkPerfection+0x4d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1156 <chkPerfection+0x46>
movl   $0x1,-0x4(%rbp)
jmp    115d <chkPerfection+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chkPerfection>:
push   %rbx
mov    %edi,%ebx
call   1030 <sum_proper_divisors@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @chkPerfection(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @sum_proper_divisors(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %17
11: ; preds = %1
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15, %10
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @chkPerfection(i32 %0) {
%2 = tail call i32 @sum_proper_divisors(i32 %0)
%3 = icmp slt i32 %2, %0
%4 = icmp sgt i32 %2, %0
%5 = zext i1 %4 to i32
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ vp8_short_fdct4x4_armv6(short *, short *, int);
void vp8_short_fdct8x4_armv6(short *input, short *output, int pitch) {
  vp8_short_fdct4x4_armv6(input, output, pitch);
  vp8_short_fdct4x4_armv6(input + 4, output + 16, pitch);
}


x86 assembly (clang, -O0):
<vp8_short_fdct8x4_armv6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <vp8_short_fdct4x4_armv6@plt>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
mov    -0x14(%rbp),%edx
call   1030 <vp8_short_fdct4x4_armv6@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_short_fdct8x4_armv6>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <vp8_short_fdct4x4_armv6@plt>
add    $0x8,%rbp
add    $0x20,%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <vp8_short_fdct4x4_armv6@plt>

LLVM IR (-O0):
define void @vp8_short_fdct8x4_armv6(i16* %0, i16* %1, i32 %2) {
%4 = alloca i16*
%5 = alloca i16*
%6 = alloca i32
store i16* %0, i16** %4
store i16* %1, i16** %5
store i32 %2, i32* %6
%7 = load i16*, i16** %4
%8 = load i16*, i16** %5
%9 = load i32, i32* %6
%10 = call i32 @vp8_short_fdct4x4_armv6(i16* %7, i16* %8, i32 %9)
%11 = load i16*, i16** %4
%12 = getelementptr inbounds i16, i16* %11, i64 4
%13 = load i16*, i16** %5
%14 = getelementptr inbounds i16, i16* %13, i64 16
%15 = load i32, i32* %6
%16 = call i32 @vp8_short_fdct4x4_armv6(i16* %12, i16* %14, i32 %15)
ret void
}

LLVM IR (-O2):
define void @vp8_short_fdct8x4_armv6(i16* %0, i16* %1, i32 %2) {
%4 = tail call i32 @vp8_short_fdct4x4_armv6(i16* %0, i16* %1, i32 %2)
%5 = getelementptr inbounds i16, i16* %0, i64 4
%6 = getelementptr inbounds i16, i16* %1, i64 16
%7 = tail call i32 @vp8_short_fdct4x4_armv6(i16* %5, i16* %6, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ disp_int(int /*<<< orphan*/);
int /*<<< orphan*/ disp_str(char *);
void TestC() {
  int i = 0x2000;
  while (1) {
    disp_str("C");
    disp_int(i++);
    disp_str(".");
    delay(1);
  }
}


x86 assembly (clang, -O0):
<TestC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2000,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <disp_str@plt>
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
call   1050 <disp_int@plt>
lea    0xe9d(%rip),%rdi
call   1030 <disp_str@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
jmp    113f <TestC+0xf>

x86 assembly (clang, -O2):
<TestC>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x2000,%ebx
lea    0xebd(%rip),%r14
lea    0xeb8(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <disp_str@plt>
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
call   1050 <disp_int@plt>
mov    %r15,%rdi
call   1030 <disp_str@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebp,%ebx
jmp    1150 <TestC+0x20>

LLVM IR (-O0):
@.str = [2 x i8] c"C\00"
@.str.1 = [2 x i8] c".\00"
define void @TestC() {
%1 = alloca i32
store i32 8192, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @disp_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = call i32 @disp_int(i32 %4)
%7 = call i32 @disp_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @delay(i32 1)
br label %2
}

LLVM IR (-O2):
@.str = [2 x i8] c"C\00"
@.str.1 = [2 x i8] c".\00"
define void @TestC() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 8192, %0 ], [ %4, %1 ]
%3 = tail call i32 @disp_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = add nuw nsw i32 %2, 1
%5 = tail call i32 @disp_int(i32 %2)
%6 = tail call i32 @disp_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @delay(i32 1)
br label %1
}
void psdraw_fillcircle(int x, int y, int z, int rad, char r, char g, char b) {}


x86 assembly (clang, -O0):
<psdraw_fillcircle>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x24(%rbp)
mov    %ecx,%eax
mov    -0x24(%rbp),%ecx
mov    %eax,-0x20(%rbp)
mov    %edx,%eax
mov    -0x20(%rbp),%edx
mov    %eax,-0x1c(%rbp)
mov    %esi,%eax
mov    -0x1c(%rbp),%esi
mov    %eax,-0x18(%rbp)
mov    %edi,%r8d
mov    -0x18(%rbp),%edi
mov    %r9b,%al
mov    0x10(%rbp),%r9b
mov    %r8d,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<psdraw_fillcircle>:
ret

LLVM IR (-O0):
define void @psdraw_fillcircle(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8 %4, i8* %12
store i8 %5, i8* %13
store i8 %6, i8* %14
ret void
}

LLVM IR (-O2):
define void @psdraw_fillcircle(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello World!\n");
  printf("SAB Rube Goldberg Hackathon!!!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
@.str.1 = [31 x i8] c"SAB Rube Goldberg Hackathon!!!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"SAB Rube Goldberg Hackathon!!!\00"
@str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int f(int x) {
  int y;
  switch (x + 1) {
  case 0:
    y = x;
  case 1:
  case 2:
    y = 3;
    break;
  default:
    y = 4;
  }
  return y;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
inc    %eax
mov    %eax,-0xc(%rbp)
je     112e <f+0x2e>
jmp    111a <f+0x1a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     1134 <f+0x34>
jmp    1140 <f+0x40>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x3,-0x8(%rbp)
jmp    1147 <f+0x47>
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
add    $0x1,%edi
cmp    $0x3,%edi
mov    $0x4,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
switch i32 %5, label %9 [
i32 0, label %6
i32 1, label %8
i32 2, label %8
]
6: ; preds = %1
%7 = load i32, i32* %2
store i32 %7, i32* %3
br label %8
8: ; preds = %1, %1, %6
store i32 3, i32* %3
br label %10
9: ; preds = %1
store i32 4, i32* %3
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp ult i32 %2, 3
%4 = select i1 %3, i32 3, i32 4
ret i32 %4
}
void shift(int x[], int d, int steps) {
  x[d] = (x[d] + steps + 10) % 10;
  return;
}


x86 assembly (clang, -O0):
<shift>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x10(%rbp),%eax
add    $0xa,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
add    %edx,%ecx
add    $0xa,%ecx
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
mov    %ecx,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @shift(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = load i32, i32* %10
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
%14 = add nsw i32 %13, 10
%15 = srem i32 %14, 10
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 %15, i32* %19
ret void
}

LLVM IR (-O2):
define void @shift(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = add i32 %2, 10
%8 = add i32 %7, %6
%9 = srem i32 %8, 10
store i32 %9, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) { printf("usage: bm src dst [offset]\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"usage: bm src dst [offset]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"usage: bm src dst [offset]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outs(char *, int);
void sp() { outs(" ", 1); }


x86 assembly (clang, -O0):
<sp>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <outs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sp>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <outs@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @sp() {
%1 = call i32 @outs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @sp() {
%1 = tail call i32 @outs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __ieee754_scalb(double, double, double *);
scalar_t__ ilogb(double);
void significand(double x, double *result) {
  __ieee754_scalb(x, (double)-ilogb(x), result);
  return;
}


x86 assembly (clang, -O0):
<significand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <ilogb@plt>
movsd  -0x18(%rbp),%xmm0
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
cvtsi2sd %rax,%xmm1
mov    -0x10(%rbp),%rdi
call   1030 <__ieee754_scalb@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<significand>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
call   1040 <ilogb@plt>
neg    %rax
cvtsi2sd %rax,%xmm1
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <__ieee754_scalb@plt>

LLVM IR (-O0):
define void @significand(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
store double %0, double* %3
store double* %1, double** %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = call i64 @ilogb(double %6)
%8 = sub nsw i64 0, %7
%9 = sitofp i64 %8 to double
%10 = load double*, double** %4
%11 = call i32 @__ieee754_scalb(double %5, double %9, double* %10)
ret void
}

LLVM IR (-O2):
define void @significand(double %0, double* %1) {
%3 = tail call i64 @ilogb(double %0)
%4 = sub nsw i64 0, %3
%5 = sitofp i64 %4 to double
%6 = tail call i32 @__ieee754_scalb(double %0, double %5, double* %1)
ret void
}
void anc_hs_start_charge(void) { return; }


x86 assembly (clang, -O0):
<anc_hs_start_charge>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anc_hs_start_charge>:
ret

LLVM IR (-O0):
define void @anc_hs_start_charge() {
ret void
}

LLVM IR (-O2):
define void @anc_hs_start_charge() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ console_write(char const *);
int /*<<< orphan*/ uart_puts(char const *);
void output(const char *msg) {
  console_write(msg);
  uart_puts(msg);
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <console_write@plt>
mov    -0x8(%rbp),%rdi
call   1040 <uart_puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %rbx
mov    %rdi,%rbx
call   1030 <console_write@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <uart_puts@plt>

LLVM IR (-O0):
define void @output(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @console_write(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @uart_puts(i8* %5)
ret void
}

LLVM IR (-O2):
define void @output(i8* %0) {
%2 = tail call i32 @console_write(i8* %0)
%3 = tail call i32 @uart_puts(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ value_as_float(unsigned int);
unsigned int fcmplt_func(unsigned int param1, unsigned int param2) {
  return value_as_float(param1) < value_as_float(param2);
}


x86 assembly (clang, -O0):
<fcmplt_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <value_as_float@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <value_as_float@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcmplt_func>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <value_as_float@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <value_as_float@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setl   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fcmplt_func(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i64 @value_as_float(i32 %5)
%7 = load i32, i32* %4
%8 = call i64 @value_as_float(i32 %7)
%9 = icmp slt i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @fcmplt_func(i32 %0, i32 %1) {
%3 = tail call i64 @value_as_float(i32 %0)
%4 = tail call i64 @value_as_float(i32 %1)
%5 = icmp slt i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printChar(int);
void clearScreen(void) {
  int i;
  for (i = 0; i < 80 * 25; i++) {
    printChar(0x08);
    printChar(0x20);
    printChar(0x08);
  }
}


x86 assembly (clang, -O0):
<clearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x7d0,-0x4(%rbp)
jge    1158 <clearScreen+0x48>
mov    $0x8,%edi
call   1030 <printChar@plt>
mov    $0x20,%edi
call   1030 <printChar@plt>
mov    $0x8,%edi
call   1030 <printChar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <clearScreen+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearScreen>:
push   %rbx
mov    $0x7d0,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x8,%edi
call   1030 <printChar@plt>
mov    $0x20,%edi
call   1030 <printChar@plt>
mov    $0x8,%edi
call   1030 <printChar@plt>
add    $0xffffffff,%ebx
jne    1120 <clearScreen+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @clearScreen() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %9, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 2000
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = call i32 @printChar(i32 8)
%7 = call i32 @printChar(i32 32)
%8 = call i32 @printChar(i32 8)
br label %9
9: ; preds = %5
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
br label %2
12: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @clearScreen() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i32 @printChar(i32 8)
%4 = tail call i32 @printChar(i32 32)
%5 = tail call i32 @printChar(i32 8)
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 2000
br i1 %7, label %8, label %1
8: ; preds = %1
ret void
}
int f3(int i) { return i ? i % 10 : 0; }


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1124 <f3+0x24>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
jmp    112e <f3+0x2e>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <f3+0x2e>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = srem i32 %6, 10
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 0, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @f3(i32 %0) {
%2 = srem i32 %0, 10
ret i32 %2
}
/* Type definitions */
struct xaddr {
  int dummy;
};
typedef int /*<<< orphan*/ hbuf;

/* Variables and functions */
int addr_ntop(struct xaddr const *, char *, int);
const char *addr_ntop_buf(const struct xaddr *a) {
  static char hbuf[64];
  if (addr_ntop(a, hbuf, sizeof(hbuf)) == -1)
    return NULL;
  return (hbuf);
}


x86 assembly (clang, -O0):
<addr_ntop_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0x2f19(%rip),%rsi
mov    $0x40,%edx
call   1030 <addr_ntop@plt>
cmp    $0xffffffff,%eax
jne    1147 <addr_ntop_buf+0x37>
movq   $0x0,-0x8(%rbp)
jmp    1152 <addr_ntop_buf+0x42>
lea    0x2ef2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addr_ntop_buf>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rsi
mov    $0x40,%edx
call   1030 <addr_ntop@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
cmovne %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.xaddr = type { i32 }
@addr_ntop_buf.hbuf = internal global [64 x i8] zeroinitializer
define i8* @addr_ntop_buf(%struct.xaddr* %0) {
%2 = alloca i8*
%3 = alloca %struct.xaddr*
store %struct.xaddr* %0, %struct.xaddr** %3
%4 = load %struct.xaddr*, %struct.xaddr** %3
%5 = call i32 @addr_ntop(%struct.xaddr* %4, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @addr_ntop_buf.hbuf, i64 0, i64 0), i32 64)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @addr_ntop_buf.hbuf, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
%struct.xaddr = type { i32 }
@addr_ntop_buf.hbuf = internal global [64 x i8] zeroinitializer
define i8* @addr_ntop_buf(%struct.xaddr* %0) {
%2 = tail call i32 @addr_ntop(%struct.xaddr* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @addr_ntop_buf.hbuf, i64 0, i64 0), i32 64)
%3 = icmp eq i32 %2, -1
%4 = select i1 %3, i8* null, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @addr_ntop_buf.hbuf, i64 0, i64 0)
ret i8* %4
}
int are_equal_ushort(const void *a, const void *b) {
  return *(unsigned short *)a == *(unsigned short *)b;
}


x86 assembly (clang, -O0):
<are_equal_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<are_equal_ushort>:
movzwl (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%cx
sete   %al
ret

LLVM IR (-O0):
define i32 @are_equal_ushort(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i16*
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i16*
%11 = load i16, i16* %10
%12 = zext i16 %11 to i32
%13 = icmp eq i32 %8, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @are_equal_ushort(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i16*
%4 = load i16, i16* %3
%5 = bitcast i8* %1 to i16*
%6 = load i16, i16* %5
%7 = icmp eq i16 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
scalar_t__ random8_max(scalar_t__);
uint8_t random8_min_max(uint8_t min, uint8_t lim) {
  uint8_t delta = lim - min;
  uint8_t r = random8_max(delta) + min;
  return r;
}


x86 assembly (clang, -O0):
<random8_min_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <random8_max@plt>
add    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random8_min_max>:
push   %rbx
mov    %rdi,%rbx
sub    %rdi,%rsi
mov    %rsi,%rdi
call   1030 <random8_max@plt>
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @random8_min_max(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %4
%8 = load i64, i64* %3
%9 = sub nsw i64 %7, %8
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = call i64 @random8_max(i64 %10)
%12 = load i64, i64* %3
%13 = add nsw i64 %11, %12
store i64 %13, i64* %6
%14 = load i64, i64* %6
ret i64 %14
}

LLVM IR (-O2):
define i64 @random8_min_max(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = tail call i64 @random8_max(i64 %3)
%5 = add nsw i64 %4, %0
ret i64 %5
}
/* Type definitions */
struct reader {
  int dummy;
};

/* Variables and functions */
int fullread(struct reader *, unsigned char *, int);
int stream_head_shift(struct reader *rds, unsigned long *head) {
  unsigned char hbuf;
  if (fullread(rds, &hbuf, 1) != 1)
    return 0;
  *head <<= 8;
  *head |= hbuf;
  *head &= 0xffffffff;
  return 1;
}


x86 assembly (clang, -O0):
<stream_head_shift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
call   1030 <fullread@plt>
cmp    $0x1,%eax
je     1147 <stream_head_shift+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1180 <stream_head_shift+0x70>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
shl    $0x8,%rcx
mov    %rcx,(%rax)
movzbl -0x19(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
or     (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movabs $0xffffffff,%rcx
and    (%rax),%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stream_head_shift>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
call   1030 <fullread@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
jne    1145 <stream_head_shift+0x35>
mov    (%rbx),%eax
shl    $0x8,%eax
movzbl 0xf(%rsp),%ecx
or     %rcx,%rax
mov    %rax,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.reader = type { i32 }
define i32 @stream_head_shift(%struct.reader* %0, i64* %1) {
%3 = alloca i32
%4 = alloca %struct.reader*
%5 = alloca i64*
%6 = alloca i8
store %struct.reader* %0, %struct.reader** %4
store i64* %1, i64** %5
%7 = load %struct.reader*, %struct.reader** %4
%8 = call i32 @fullread(%struct.reader* %7, i8* %6, i32 1)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %23
11: ; preds = %2
%12 = load i64*, i64** %5
%13 = load i64, i64* %12
%14 = shl i64 %13, 8
store i64 %14, i64* %12
%15 = load i8, i8* %6
%16 = zext i8 %15 to i64
%17 = load i64*, i64** %5
%18 = load i64, i64* %17
%19 = or i64 %18, %16
store i64 %19, i64* %17
%20 = load i64*, i64** %5
%21 = load i64, i64* %20
%22 = and i64 %21, 4294967295
store i64 %22, i64* %20
store i32 1, i32* %3
br label %23
23: ; preds = %11, %10
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
%struct.reader = type { i32 }
define i32 @stream_head_shift(%struct.reader* %0, i64* nocapture %1) {
%3 = alloca i8
%4 = call i32 @fullread(%struct.reader* %0, i8* %3, i32 1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i64, i64* %1
%8 = shl i64 %7, 8
%9 = load i8, i8* %3
%10 = zext i8 %9 to i64
%11 = and i64 %8, 4294967040
%12 = or i64 %11, %10
store i64 %12, i64* %1
br label %13
13: ; preds = %2, %6
%14 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ TimerList_Init();
void TimerScheduler_Init(void) { TimerList_Init(); }


x86 assembly (clang, -O0):
<TimerScheduler_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <TimerList_Init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerScheduler_Init>:
xor    %eax,%eax
jmp    1030 <TimerList_Init@plt>

LLVM IR (-O0):
define void @TimerScheduler_Init() {
%1 = call i32 (...) @TimerList_Init()
ret void
}

LLVM IR (-O2):
define void @TimerScheduler_Init() {
%1 = tail call i32 (...) @TimerList_Init()
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare(const void *a, const void *b) {
  const char **ia = (const char **)a;
  const char **ib = (const char **)b;
  return strcmp(*ia, *ib);
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
void proc_nmi_enabled(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<proc_nmi_enabled>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_nmi_enabled>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.proc_nmi_enabled = [17 x i8] c"proc_nmi_enabled\00"
define void @proc_nmi_enabled() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.proc_nmi_enabled, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.proc_nmi_enabled = [17 x i8] c"proc_nmi_enabled\00"
define void @proc_nmi_enabled() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.proc_nmi_enabled, i64 0, i64 0))
ret void
}
/* Type definitions */
struct wl_proxy {
  int dummy;
};
struct wl_compositor {
  int dummy;
};

/* Variables and functions */
void *wl_proxy_get_user_data(struct wl_proxy *);
void *wl_compositor_get_user_data(struct wl_compositor *wl_compositor) {
  return wl_proxy_get_user_data((struct wl_proxy *)wl_compositor);
}


x86 assembly (clang, -O0):
<wl_compositor_get_user_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <wl_proxy_get_user_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_compositor_get_user_data>:
jmp    1030 <wl_proxy_get_user_data@plt>

LLVM IR (-O0):
%struct.wl_compositor = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_compositor_get_user_data(%struct.wl_compositor* %0) {
%2 = alloca %struct.wl_compositor*
store %struct.wl_compositor* %0, %struct.wl_compositor** %2
%3 = load %struct.wl_compositor*, %struct.wl_compositor** %2
%4 = bitcast %struct.wl_compositor* %3 to %struct.wl_proxy*
%5 = call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.wl_compositor = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_compositor_get_user_data(%struct.wl_compositor* %0) {
%2 = bitcast %struct.wl_compositor* %0 to %struct.wl_proxy*
%3 = tail call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %2)
ret i8* %3
}
char HEX(char x) {
  char res = 0;
  if (x >= '0' && x <= '9') {
    res = x - '0';
  }
  if (x >= 'A' && x <= 'F') {
    res = x - 'A' + 10;
  }
  if (x >= 'a' && x <= 'f') {
    res = x - 'a' + 10;
  }
  return res;
}


x86 assembly (clang, -O0):
<HEX>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1132 <HEX+0x32>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     1132 <HEX+0x32>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1159 <HEX+0x59>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
jg     1159 <HEX+0x59>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1180 <HEX+0x80>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
jg     1180 <HEX+0x80>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HEX>:
lea    -0x30(%rdi),%eax
xor    %ecx,%ecx
cmp    $0xa,%al
movzbl %al,%eax
cmovae %ecx,%eax
lea    -0x41(%rdi),%ecx
lea    -0x37(%rdi),%edx
cmp    $0x6,%cl
movzbl %dl,%ecx
cmovae %eax,%ecx
lea    -0x61(%rdi),%eax
add    $0xa9,%dil
cmp    $0x6,%al
movzbl %dil,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @HEX(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
br label %16
16: ; preds = %11, %7, %1
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 70
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 65
%28 = add nsw i32 %27, 10
%29 = trunc i32 %28 to i8
store i8 %29, i8* %3
br label %30
30: ; preds = %24, %20, %16
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = icmp sge i32 %32, 97
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp sle i32 %36, 102
br i1 %37, label %38, label %44
38: ; preds = %34
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 97
%42 = add nsw i32 %41, 10
%43 = trunc i32 %42 to i8
store i8 %43, i8* %3
br label %44
44: ; preds = %38, %34, %30
%45 = load i8, i8* %3
ret i8 %45
}

LLVM IR (-O2):
define signext i8 @HEX(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = select i1 %3, i8 %2, i8 0
%5 = add i8 %0, -65
%6 = icmp ult i8 %5, 6
%7 = add i8 %0, -55
%8 = select i1 %6, i8 %7, i8 %4
%9 = add i8 %0, -97
%10 = icmp ult i8 %9, 6
%11 = add i8 %0, -87
%12 = select i1 %10, i8 %11, i8 %8
ret i8 %12
}
int stdin_getchar(void) { return (-1); }


x86 assembly (clang, -O0):
<stdin_getchar>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdin_getchar>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @stdin_getchar() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @stdin_getchar() {
ret i32 -1
}
/* Variables and functions */
size_t eiki_strlen(const char *s) {
  const char *s2 = s;
  while (*s2) {
    s2++;
  }
  return s2 - s;
}


x86 assembly (clang, -O0):
<eiki_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <eiki_strlen+0x2e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <eiki_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eiki_strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <eiki_strlen+0x10>
ret

LLVM IR (-O0):
define i64 @eiki_strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %9, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
br label %5
12: ; preds = %5
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @eiki_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}