xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void rectangle() {
  printf("___________\n");
  printf("|          |\n");
  printf("|          |\n");
  printf("|          |\n");
  printf("|          |\n");
  printf("|__________|\n");
}


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

x86 assembly (clang, -O2):
<rectangle>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"___________\0A\00"
@.str.1 = [14 x i8] c"| |\0A\00"
@.str.2 = [14 x i8] c"|__________|\0A\00"
define void @rectangle() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"___________\00"
@str.6 = [13 x i8] c"| |\00"
@str.7 = [13 x i8] c"|__________|\00"
define void @rectangle() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
ret void
}
int test_imm_41uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x41 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_41uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x41,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_41uint64_midword_reg>:
test   $0x410000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_41uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 65
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_41uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 4259840
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void SysCtlResetCauseClear(unsigned long ulCauses) {
  (*((volatile unsigned long *)(0x400FE05C))) &= ~(ulCauses);
}


x86 assembly (clang, -O0):
<SysCtlResetCauseClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    $0x400fe05c,%ecx
mov    (%rcx),%rcx
and    %rax,%rcx
mov    $0x400fe05c,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlResetCauseClear>:
not    %rdi
and    %rdi,0x400fe05c
40
ret

LLVM IR (-O0):
define void @SysCtlResetCauseClear(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = load volatile i64, i64* inttoptr (i64 1074782300 to i64*)
%6 = and i64 %5, %4
store volatile i64 %6, i64* inttoptr (i64 1074782300 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlResetCauseClear(i64 %0) {
%2 = xor i64 %0, -1
%3 = load volatile i64, i64* inttoptr (i64 1074782300 to i64*)
%4 = and i64 %3, %2
store volatile i64 %4, i64* inttoptr (i64 1074782300 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i0;
  i0 = 0;
  int i1;
  for (i1 = 0; i1 - 9 <= 0; i1 = i1 + 1) {
    int i3;
    for (i3 = 0; i3 - 9 <= 0; i3 = i3 + 1) {
      i0 = i0 + 10;
    }
  }
  printf("%d\n", i0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
cmp    $0x0,%eax
jg     117c <main+0x6c>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
cmp    $0x0,%eax
jg     1169 <main+0x59>
mov    -0x8(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1143 <main+0x33>
jmp    116e <main+0x5e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x3e8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %21, %0
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 9
%8 = icmp sle i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %5
store i32 0, i32* %4
br label %10
10: ; preds = %17, %9
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 9
%13 = icmp sle i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 10
store i32 %16, i32* %2
br label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %10
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = load i32, i32* %2
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void t3(long long x) {
  if (x != 0x80000fffULL)
    abort();
}


x86 assembly (clang, -O0):
<t3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x80000fff,%eax
cmp    %rax,-0x8(%rbp)
je     1132 <t3+0x22>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t3>:
mov    $0x80000fff,%eax
cmp    %rax,%rdi
jne    111b <t3+0xb>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @t3(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ne i64 %3, 2147487743
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @t3(i64 %0) {
%2 = icmp eq i64 %0, 2147487743
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ maxHeapify(int *, int, int *);
void buildMaxHeap(int arr[], int length, int *heapSize) {
  int i;
  *heapSize = length - 1;
  for (i = length / 2; i >= 0; i--)
    maxHeapify(arr, i, heapSize);
}


x86 assembly (clang, -O0):
<buildMaxHeap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1165 <buildMaxHeap+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <maxHeapify@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <buildMaxHeap+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildMaxHeap>:
push   %rbp
push   %r14
push   %rbx
lea    -0x1(%rsi),%eax
mov    %eax,(%rdx)
cmp    $0xffffffff,%esi
jl     1142 <buildMaxHeap+0x32>
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <maxHeapify@plt>
add    $0xffffffff,%ebp
jb     1130 <buildMaxHeap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @buildMaxHeap(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = load i32*, i32** %6
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = sdiv i32 %11, 2
store i32 %12, i32* %7
br label %13
13: ; preds = %21, %3
%14 = load i32, i32* %7
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32*, i32** %4
%18 = load i32, i32* %7
%19 = load i32*, i32** %6
%20 = call i32 @maxHeapify(i32* %17, i32 %18, i32* %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %7
%23 = add nsw i32 %22, -1
store i32 %23, i32* %7
br label %13
24: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @buildMaxHeap(i32* %0, i32 %1, i32* %2) {
%4 = add nsw i32 %1, -1
store i32 %4, i32* %2
%5 = icmp sgt i32 %1, -2
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = sdiv i32 %1, 2
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ %11, %8 ], [ %7, %6 ]
%10 = tail call i32 @maxHeapify(i32* %0, i32 %9, i32* %2)
%11 = add nsw i32 %9, -1
%12 = icmp eq i32 %9, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, int);
void memcpy_ident32(void *dst, const void *src, size_t n) {
  memcpy(dst, src, 4 * n);
}


x86 assembly (clang, -O0):
<memcpy_ident32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcpy_ident32>:
shl    $0x2,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @memcpy_ident32(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = mul i64 4, %9
%11 = trunc i64 %10 to i32
%12 = call i32 @memcpy(i8* %7, i8* %8, i32 %11)
ret void
}

LLVM IR (-O2):
define void @memcpy_ident32(i8* %0, i8* %1, i64 %2) {
%4 = trunc i64 %2 to i32
%5 = shl i32 %4, 2
%6 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hola a tothom"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hola a tothom\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hola a tothom\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned int highestOneBitPosition(unsigned long a) {
  unsigned int bits = 0;
  while (a != 0) {
    ++bits;
    a >>= 1;
  };
  return bits;
}


x86 assembly (clang, -O0):
<highestOneBitPosition>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1134 <highestOneBitPosition+0x34>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <highestOneBitPosition+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<highestOneBitPosition>:
xor    %eax,%eax
test   %rdi,%rdi
je     111f <highestOneBitPosition+0x1f>
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
shr    %rcx
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <highestOneBitPosition+0x10>
ret

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

LLVM IR (-O2):
define i32 @highestOneBitPosition(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = lshr i64 %5, 1
%8 = icmp ult i64 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x68() {
  Assert_real((isdigit(104) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              525, ("isdigit should be 0 for h"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x68>:
push   %rbp
mov    %rsp,%rbp
mov    $0x68,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x20d,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x68>:
push   %rax
mov    $0x68,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x20d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for h\00"
define void @t_isdigit_0x68() {
%1 = call i64 @isdigit(i32 104)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 525, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for h\00"
define void @t_isdigit_0x68() {
%1 = tail call i64 @isdigit(i32 104)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 525, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ values;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ absolute_value(int);
int main(void) {
  int values[] = {0x0, -1, 0x00000001, 0xFFFFFF00, 0xFFFFFEFF, 10};
  for (int i = 0; i < sizeof(values) / sizeof(values[0]); i++)
    absolute_value(values[i]);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x6,%rax
jae    1170 <main+0x60>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1030 <absolute_value@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1147 <main+0x37>
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <absolute_value@plt>
mov    $0xffffffff,%edi
call   1030 <absolute_value@plt>
mov    $0x1,%edi
call   1030 <absolute_value@plt>
mov    $0xffffff00,%edi
call   1030 <absolute_value@plt>
mov    $0xfffffeff,%edi
call   1030 <absolute_value@plt>
mov    $0xa,%edi
call   1030 <absolute_value@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.values = [6 x i32] [i32 0, i32 -1, i32 1, i32 -256, i32 -257, i32 10]
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 6
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @absolute_value(i32 %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %5
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @absolute_value(i32 0)
%2 = tail call i32 @absolute_value(i32 -1)
%3 = tail call i32 @absolute_value(i32 1)
%4 = tail call i32 @absolute_value(i32 -256)
%5 = tail call i32 @absolute_value(i32 -257)
%6 = tail call i32 @absolute_value(i32 10)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
int find_machine_endiness() {
  int val = 1;
  char *ch = (char *)&val;
  if ((int)ch[0] == 1) {
    return (1);
  }
  return (2);
}


x86 assembly (clang, -O0):
<find_machine_endiness>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1,%eax
jne    112f <find_machine_endiness+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1136 <find_machine_endiness+0x36>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @find_machine_endiness() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 1, i32* %2
%4 = bitcast i32* %2 to i8*
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 1, i32* %1
br label %12
11: ; preds = %0
store i32 2, i32* %1
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @find_machine_endiness() {
ret i32 1
}
/* Variables and functions */
double __ocml_sin_f64(double);
double sin(double x) { return __ocml_sin_f64(x); }


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

x86 assembly (clang, -O2):
<sin>:
jmp    1030 <__ocml_sin_f64@plt>

LLVM IR (-O0):
define double @sin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__ocml_sin_f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @sin(double %0) {
%2 = tail call double @__ocml_sin_f64(double %0)
ret double %2
}
int intcomp(const void *v1, const void *v2) {
  int *i1 = (int *)v1;
  int *i2 = (int *)v2;
  if (*i1 < *i2)
    return -1;
  else if (*i1 > *i2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<intcomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    113a <intcomp+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1164 <intcomp+0x64>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    1158 <intcomp+0x58>
movl   $0x1,-0x4(%rbp)
jmp    1164 <intcomp+0x64>
jmp    115d <intcomp+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcomp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @intcomp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = icmp sgt i32 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int EOF;
int getchar();
int get_one_letter(void) {
  int c, first;
  first = c = getchar();
  while (c != '\n' && c != EOF) {
    c = getchar();
  }
  return (first);
}


x86 assembly (clang, -O0):
<get_one_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1146 <get_one_letter+0x36>
mov    -0x4(%rbp),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1156 <get_one_letter+0x46>
jmp    1165 <get_one_letter+0x55>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
jmp    1125 <get_one_letter+0x15>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_one_letter>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
cmp    $0xa,%eax
je     1140 <get_one_letter+0x30>
mov    0x2ec0(%rip),%rbx
cmp    (%rbx),%ebp
je     1140 <get_one_letter+0x30>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1140 <get_one_letter+0x30>
cmp    (%rbx),%eax
jne    1130 <get_one_letter+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @get_one_letter() {
%1 = tail call i32 (...) @getchar()
%2 = icmp ne i32 %1, 10
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %1, %3
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %6, label %12
6: ; preds = %0, %6
%7 = tail call i32 (...) @getchar()
%8 = icmp ne i32 %7, 10
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %7, %9
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %6, label %12
12: ; preds = %6, %0
ret i32 %1
}
/* Variables and functions */
int random();
int func1(void) { return random(); }


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

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

LLVM IR (-O0):
define i32 @func1() {
%1 = call i32 (...) @random()
ret i32 %1
}

LLVM IR (-O2):
define i32 @func1() {
%1 = tail call i32 (...) @random()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ __atomic_fetch_add_4(int /*<<< orphan*/ *, int,
                                        int /*<<< orphan*/);
int main(int argc, char **argv) {
  uint32_t var;
  __atomic_fetch_add_4(&var, 1, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <__atomic_fetch_add_4@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <__atomic_fetch_add_4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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
%7 = call i32 @__atomic_fetch_add_4(i32* %6, i32 1, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @__atomic_fetch_add_4(i32* %3, i32 1, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, unsigned int);
void extract_bytes(void *state, unsigned char *data, unsigned int offset,
                   unsigned int length) {
  memcpy(data, (unsigned char *)state + offset, length);
}


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

x86 assembly (clang, -O2):
<extract_bytes>:
mov    %rsi,%rax
mov    %edx,%esi
add    %rdi,%rsi
mov    %rax,%rdi
mov    %ecx,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @extract_bytes(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = load i32, i32* %7
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i32, i32* %8
%15 = call i32 @memcpy(i8* %9, i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @extract_bytes(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @memcpy(i8* %1, i8* %6, i32 %3)
ret void
}
int iswhite(char c) {
  if (c == ' ')
    return 1;
  if (c == '\t')
    return 1;
  if (c == '\n')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<iswhite>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1123 <iswhite+0x23>
movl   $0x1,-0x4(%rbp)
jmp    115c <iswhite+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    113c <iswhite+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    115c <iswhite+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    1155 <iswhite+0x55>
movl   $0x1,-0x4(%rbp)
jmp    115c <iswhite+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswhite>:
cmp    $0x20,%dil
ja     1120 <iswhite+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <iswhite+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @iswhite(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 32
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %19
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 9
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %2
br label %19
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %2
br label %19
18: ; preds = %13
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @iswhite(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 9, label %3
i8 10, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void debug_print_square(int i, int j) { printf("%c%d\n", i + 97, 8 - j); }


x86 assembly (clang, -O0):
<debug_print_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
add    $0x61,%esi
mov    $0x8,%edx
sub    -0x8(%rbp),%edx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_print_square>:
lea    0x61(%rdi),%eax
mov    $0x8,%edx
sub    %esi,%edx
lea    0xedf(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%c%d\0A\00"
define void @debug_print_square(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 = add nsw i32 %5, 97
%7 = load i32, i32* %4
%8 = sub nsw i32 8, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%c%d\0A\00"
define void @debug_print_square(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 97
%4 = sub nsw i32 8, %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_filename();
int /*<<< orphan*/ test_insert();
int /*<<< orphan*/ test_lookup();
int /*<<< orphan*/ test_rw();
int /*<<< orphan*/ test_str_match_range();
int /*<<< orphan*/ test_tar();
int main() {
  test_str_match_range();
  test_filename();
  test_lookup();
  test_insert();
  test_rw();
  test_tar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_str_match_range@plt>
mov    $0x0,%al
call   1070 <test_filename@plt>
mov    $0x0,%al
call   1050 <test_lookup@plt>
mov    $0x0,%al
call   1080 <test_insert@plt>
mov    $0x0,%al
call   1060 <test_rw@plt>
mov    $0x0,%al
call   1040 <test_tar@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_str_match_range@plt>
xor    %eax,%eax
call   1070 <test_filename@plt>
xor    %eax,%eax
call   1050 <test_lookup@plt>
xor    %eax,%eax
call   1080 <test_insert@plt>
xor    %eax,%eax
call   1060 <test_rw@plt>
xor    %eax,%eax
call   1040 <test_tar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test_str_match_range()
%2 = call i32 (...) @test_filename()
%3 = call i32 (...) @test_lookup()
%4 = call i32 (...) @test_insert()
%5 = call i32 (...) @test_rw()
%6 = call i32 (...) @test_tar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_str_match_range()
%2 = tail call i32 (...) @test_filename()
%3 = tail call i32 (...) @test_lookup()
%4 = tail call i32 (...) @test_insert()
%5 = tail call i32 (...) @test_rw()
%6 = tail call i32 (...) @test_tar()
ret i32 0
}
void TestExpectEqFail(void) {
  TestExpect("(1) == (10)",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/google/makani/refs/heads/master/"
             "avionics/firmware/test/test_test.c",
             __func__, 150, (1) == (10));
}


x86 assembly (clang, -O0):
<TestExpectEqFail>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeea(%rip),%rsi
lea    0xf80(%rip),%rdx
mov    $0x96,%ecx
xor    %r8d,%r8d
mov    $0x0,%al
call   1030 <TestExpect@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestExpectEqFail>:
lea    0xee9(%rip),%rdi
lea    0xeee(%rip),%rsi
lea    0xf84(%rip),%rdx
mov    $0x96,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
jmp    1030 <TestExpect@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"(1) == (10)\00"
@.str.1 = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/google/makani/refs/heads/master/avionics/firmware/test/test_test.c\00"
@__func__.TestExpectEqFail = [17 x i8] c"TestExpectEqFail\00"
define void @TestExpectEqFail() {
%1 = call i32 (i8*, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @TestExpect to i32 (i8*, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.TestExpectEqFail, i64 0, i64 0), i32 150, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"(1) == (10)\00"
@.str.1 = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/google/makani/refs/heads/master/avionics/firmware/test/test_test.c\00"
@__func__.TestExpectEqFail = [17 x i8] c"TestExpectEqFail\00"
define void @TestExpectEqFail() {
%1 = tail call i32 (i8*, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @TestExpect to i32 (i8*, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.TestExpectEqFail, i64 0, i64 0), i32 150, i32 0)
ret void
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
int main() {
  printf("%d\n", getpid());
  for (;;) {
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1154 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getpid()
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %4
4: ; preds = %4, %0
%5 = call i32 @sleep(i32 1)
br label %4
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @sleep(i32 1)
br label %3
}
f_impl2(void) { return 0; }


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

x86 assembly (clang, -O2):
<f_impl2>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @f_impl2() {
ret i32 0
}

LLVM IR (-O2):
define i32 @f_impl2() {
ret i32 0
}
char getrgbindex(int r, int g, int b) {
  return (r >= 96 ? 1 : 0) | (g >= 96 ? 2 : 0) | (b >= 96 ? 4 : 0);
}


x86 assembly (clang, -O0):
<getrgbindex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x60,%edx
cmovge %ecx,%eax
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x2,%edx
cmp    $0x60,%esi
cmovge %edx,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%esi
xor    %ecx,%ecx
mov    $0x4,%edx
cmp    $0x60,%esi
cmovge %edx,%ecx
or     %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrgbindex>:
cmp    $0x60,%edi
setge  %al
cmp    $0x60,%esi
setge  %cl
add    %cl,%cl
or     %al,%cl
cmp    $0x60,%edx
setge  %al
shl    $0x2,%al
or     %cl,%al
ret

LLVM IR (-O0):
define signext i8 @getrgbindex(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 = icmp sge i32 %7, 96
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
%11 = load i32, i32* %5
%12 = icmp sge i32 %11, 96
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 2, i32 0
%15 = or i32 %10, %14
%16 = load i32, i32* %6
%17 = icmp sge i32 %16, 96
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 4, i32 0
%20 = or i32 %15, %19
%21 = trunc i32 %20 to i8
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @getrgbindex(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 95
%5 = zext i1 %4 to i8
%6 = icmp sgt i32 %1, 95
%7 = select i1 %6, i8 2, i8 0
%8 = or i8 %7, %5
%9 = icmp sgt i32 %2, 95
%10 = select i1 %9, i8 4, i8 0
%11 = or i8 %8, %10
ret i8 %11
}
/* Variables and functions */
int /*<<< orphan*/ DrawLevelElementExt(int, int, int, int, int, int,
                                       int /*<<< orphan*/);
void DrawLevelElementShifted(int x, int y, int dx, int dy, int element,
                             int cut_mode) {
  DrawLevelElementExt(x, y, dx, dy, element, cut_mode, 0);
}


x86 assembly (clang, -O0):
<DrawLevelElementShifted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <DrawLevelElementExt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawLevelElementShifted>:
push   %rax
movl   $0x0,(%rsp)
call   1030 <DrawLevelElementExt@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @DrawLevelElementShifted(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = call i32 @DrawLevelElementExt(i32 %13, i32 %14, i32 %15, i32 %16, i32 %17, i32 %18, i32 0)
ret void
}

LLVM IR (-O2):
define void @DrawLevelElementShifted(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @DrawLevelElementExt(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 0)
ret void
}
void load_idtr(struct IDTR *idtr) {
  __asm__ __volatile__("lidt (%0)" : : "q"(idtr));
}


x86 assembly (clang, -O0):
<load_idtr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lidt   (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_idtr>:
lidt   (%rdi)
ret

LLVM IR (-O0):
%struct.IDTR = type opaque
define void @load_idtr(%struct.IDTR* %0) {
%2 = alloca %struct.IDTR*
store %struct.IDTR* %0, %struct.IDTR** %2
%3 = load %struct.IDTR*, %struct.IDTR** %2
ret void
}

LLVM IR (-O2):
%struct.IDTR = type opaque
define void @load_idtr(%struct.IDTR* %0) {
tail call void asm sideeffect "lidt ($0)", "q,~{dirflag},~{fpsr},~{flags}"(%struct.IDTR* %0)
ret void
}
/* Variables and functions */
int cpuid_scan(char *);
bool kvm_check(void) { return cpuid_scan("KVMKVMKVM"); }


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"KVMKVMKVM\00"
define i32 @kvm_check() {
%1 = tail call i32 @cpuid_scan(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
char *DES_crypt(char const *, char const *);
char *_ossl_old_crypt(const char *buf, const char *salt) {
  return DES_crypt(buf, salt);
}


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

x86 assembly (clang, -O2):
<_ossl_old_crypt>:
jmp    1030 <DES_crypt@plt>

LLVM IR (-O0):
define i8* @_ossl_old_crypt(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 = load i8*, i8** %4
%7 = call i8* @DES_crypt(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @_ossl_old_crypt(i8* %0, i8* %1) {
%3 = tail call i8* @DES_crypt(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void c_func() { printf("C function called.\n"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"C function called.\0A\00"
define void @c_func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"C function called.\00"
define void @c_func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void log_success(char *str) { printf("[OK] %s\n", str); }


x86 assembly (clang, -O0):
<log_success>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_success>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"[OK] %s\0A\00"
define void @log_success(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"[OK] %s\0A\00"
define void @log_success(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lfiletonext();
int /*<<< orphan*/ lnexttoscreen();
int /*<<< orphan*/ updatescreen();
void updateline() {
  if (!lfiletonext()) {
    updatescreen();
  } else {
    lnexttoscreen();
  }
}


x86 assembly (clang, -O0):
<updateline>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <lfiletonext@plt>
cmp    $0x0,%eax
jne    1150 <updateline+0x20>
mov    $0x0,%al
call   1050 <updatescreen@plt>
jmp    1157 <updateline+0x27>
mov    $0x0,%al
call   1030 <lnexttoscreen@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateline>:
push   %rax
xor    %eax,%eax
call   1040 <lfiletonext@plt>
test   %eax,%eax
je     1144 <updateline+0x14>
xor    %eax,%eax
pop    %rcx
jmp    1030 <lnexttoscreen@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <updatescreen@plt>

LLVM IR (-O0):
define void @updateline() {
%1 = call i32 (...) @lfiletonext()
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 (...) @updatescreen()
br label %7
5: ; preds = %0
%6 = call i32 (...) @lnexttoscreen()
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
define void @updateline() {
%1 = tail call i32 (...) @lfiletonext()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @updatescreen()
br label %7
5: ; preds = %0
%6 = tail call i32 (...) @lnexttoscreen()
br label %7
7: ; preds = %5, %3
ret void
}
double MAX(double x, double y) {
  if (x > y)
    return x;
  else
    return y;
}


x86 assembly (clang, -O0):
<MAX>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112d <MAX+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <MAX+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAX>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @MAX(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @MAX(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int g(int month) { return (month <= 2) ? (month + 13) : (month + 1); }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jg     111f <g+0x1f>
mov    -0x4(%rbp),%eax
add    $0xd,%eax
mov    %eax,-0x8(%rbp)
jmp    1128 <g+0x28>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
lea    0x1(%rdi),%ecx
lea    0xd(%rdi),%eax
cmp    $0x3,%edi
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = icmp slt i32 %0, 3
%3 = select i1 %2, i32 13, i32 1
%4 = add nsw i32 %3, %0
ret i32 %4
}