xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
char *string_copy(const char *s) {
  char *result;
  int l;
  if (s == 0)
    return 0;
  l = strlen(s) + 1;
  result = (char *)malloc(sizeof(char) * l);
  memcpy(result, s, l);
  return result;
}


x86 assembly (clang, -O0):
<string_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <string_copy+0x24>
movq   $0x0,-0x8(%rbp)
jmp    118e <string_copy+0x5e>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_copy>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     115d <string_copy+0x2d>
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
jmp    1160 <string_copy+0x30>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @string_copy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %24
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = mul i64 1, %14
%16 = trunc i64 %15 to i32
%17 = call i64 @malloc(i32 %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %4
%19 = load i8*, i8** %4
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = call i32 @memcpy(i8* %19, i8* %20, i32 %21)
%23 = load i8*, i8** %4
store i8* %23, i8** %2
br label %24
24: ; preds = %9, %8
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
define i8* @string_copy(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @memcpy(i8* %7, i8* %0, i32 %5)
br label %9
9: ; preds = %1, %3
%10 = phi i8* [ %7, %3 ], [ null, %1 ]
ret i8* %10
}
/* Variables and functions */
char *strchr(char const *, int);
char *strnchr(const char *s, int c) {
  char *next = strchr(s, c);
  if (next)
    next += 1;
  return next;
}


x86 assembly (clang, -O0):
<strnchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1146 <strnchr+0x36>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnchr>:
push   %rax
call   1030 <strchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @strnchr(i8* %0, i32 %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 %1)
%4 = icmp eq i8* %3, null
%5 = getelementptr inbounds i8, i8* %3, i64 1
%6 = select i1 %4, i8* null, i8* %5
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void driver_display_info(char *message) { printf("info: %s\n", message); }


x86 assembly (clang, -O0):
<driver_display_info>:
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):
<driver_display_info>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"info: %s\0A\00"
define void @driver_display_info(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef float ptrdiff_t;

/* Variables and functions */
ptrdiff_t ffloor(float x) {
  ptrdiff_t ix = (ptrdiff_t)x;
  return ix - (ix > x);
}


x86 assembly (clang, -O0):
<ffloor>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
ucomiss -0x4(%rbp),%xmm1
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @ffloor(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
store float %4, float* %3
%5 = load float, float* %3
%6 = load float, float* %3
%7 = load float, float* %2
%8 = fcmp ogt float %6, %7
%9 = zext i1 %8 to i32
%10 = sitofp i32 %9 to float
%11 = fsub float %5, %10
ret float %11
}

LLVM IR (-O2):
define float @ffloor(float returned %0) {
ret float %0
}
int test_imm_6Euint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x6E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_6Euint64_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, 110
%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_6Euint64_midword_reg(i64 %0) {
%2 = and i64 %0, 7208960
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int string_length(const char string[]) {
  int count = 0;
  while (string[count] != '\0') {
    ++count;
  }
  return count;
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <string_length+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <string_length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <string_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @string_length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("hello arm!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello arm!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"hello arm!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
float modulus(float b, float m) { return (b / m - (int)(b / m)) * m; }


x86 assembly (clang, -O0):
<modulus>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
divss  -0x8(%rbp),%xmm1
cvttss2si %xmm1,%eax
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<modulus>:
divss  %xmm1,%xmm0
cvttps2dq %xmm0,%xmm2
cvtdq2ps %xmm2,%xmm2
subss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @modulus(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fdiv float %5, %6
%8 = load float, float* %3
%9 = load float, float* %4
%10 = fdiv float %8, %9
%11 = fptosi float %10 to i32
%12 = sitofp i32 %11 to float
%13 = fsub float %7, %12
%14 = load float, float* %4
%15 = fmul float %13, %14
ret float %15
}

LLVM IR (-O2):
define float @modulus(float %0, float %1) {
%3 = fdiv float %0, %1
%4 = fptosi float %3 to i32
%5 = sitofp i32 %4 to float
%6 = fsub float %3, %5
%7 = fmul float %6, %1
ret float %7
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t getu32(uint8_t *buffer) {
  return buffer[0] + (buffer[1] << 8) + (buffer[2] << 16) + (buffer[3] << 24);
}


x86 assembly (clang, -O0):
<getu32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getu32>:
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%ecx
shl    $0x8,%eax
add    (%rdi),%eax
shl    $0x10,%ecx
add    %eax,%ecx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getu32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = add nsw i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = add nsw i32 %6, %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = add nsw i32 %10, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isprint(int);
void t_isprint_0xcf() {
  Assert_real((isprint(207) == 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_isprint.c",
              1040, ("isprint should be 0 for 0xcf"));
}


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

x86 assembly (clang, -O2):
<t_isprint_0xcf>:
push   %rax
mov    $0xcf,%edi
call   1030 <isprint@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x410,%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_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xcf\00"
define void @t_isprint_0xcf() {
%1 = call i64 @isprint(i32 207)
%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 1040, i8* getelementptr inbounds ([29 x i8], [29 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_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xcf\00"
define void @t_isprint_0xcf() {
%1 = tail call i64 @isprint(i32 207)
%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 1040, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
test01(const char *s1) { return __builtin_strncmp(s1, "abcde", 3); }


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

x86 assembly (clang, -O2):
<test01>:
lea    0xee9(%rip),%rsi
mov    $0x3,%edx
jmp    1030 <strncmp@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"abcde\00"
define i32 @test01(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strncmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [6 x i8] c"abcde\00"
define i32 @test01(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  char *x;
  write(1, "A\n", 2);
  x = malloc(8);
  write(1, "B\n", 2);
  free(x);
  write(1, "C\n", 2);
  free(x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xeb5(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
lea    0xe94(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%edi
lea    0xe78(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe8d(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"A\0A\00"
@.str.1 = [3 x i8] c"B\0A\00"
@.str.2 = [3 x i8] c"C\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = call i8* @malloc(i32 8)
store i8* %4, i8** %2
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
%8 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"A\0A\00"
@.str.1 = [3 x i8] c"B\0A\00"
@.str.2 = [3 x i8] c"C\0A\00"
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%4 = tail call i32 @free(i8* %2)
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%6 = tail call i32 @free(i8* %2)
ret i32 0
}
/* Variables and functions */
int RAND_MAX;
int rand();
int randint(int start, int end) {
  int r = rand() / (RAND_MAX / (end - start + 1) + 1);
  return r;
}


x86 assembly (clang, -O0):
<randint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
mov    %eax,%esi
add    $0x1,%esi
mov    %ecx,%eax
cltd
idiv   %esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @randint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (...) @rand()
%7 = load i32, i32* @RAND_MAX
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = sub nsw i32 %8, %9
%11 = add nsw i32 %10, 1
%12 = sdiv i32 %7, %11
%13 = add nsw i32 %12, 1
%14 = sdiv i32 %6, %13
store i32 %14, i32* %5
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @randint(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = load i32, i32* @RAND_MAX
%5 = sub i32 1, %0
%6 = add i32 %5, %1
%7 = sdiv i32 %4, %6
%8 = add nsw i32 %7, 1
%9 = sdiv i32 %3, %8
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(int argc, char **argv) {
  printf("%ld %ld %ld %ld\n", sizeof(int), sizeof(long), sizeof(long long),
         sizeof(time_t));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x4,%r8d
mov    $0x8,%ecx
mov    %r8d,%esi
mov    %ecx,%edx
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    $0x4,%esi
mov    $0x8,%edx
mov    $0x8,%ecx
mov    $0x4,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%ld %ld %ld %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4, i32 8, i32 8, i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"%ld %ld %ld %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4, i32 8, i32 8, i32 4)
ret i32 0
}
/* Variables and functions */
int sprintf(char *, char *, int);
int ssds_class_id(int fd, int class_num, char *sp) {
  int ret;
  ret = sprintf(sp, "%d", class_num + 1);
  return ret;
}


x86 assembly (clang, -O0):
<ssds_class_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
lea    0xecd(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_class_id>:
mov    %rdx,%rdi
lea    0x1(%rsi),%edx
lea    0xee3(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @ssds_class_id(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @ssds_class_id(i32 %0, i32 %1, i8* nocapture writeonly %2) {
%4 = add nsw i32 %1, 1
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 %5
}
int assoluto(int x) {
  if (x < 0) {
    return -x;
  }
  return x;
}


x86 assembly (clang, -O0):
<assoluto>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <assoluto+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <assoluto+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assoluto>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @assoluto(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_octave_line_comment_1() {
  test_parser_verify_parse(test_parser_sourcefile("octave", " %comment"),
                           "octave", "", "%comment", 0);
}


x86 assembly (clang, -O0):
<test_octave_line_comment_1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xebf(%rip),%rdx
lea    0xeba(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_octave_line_comment_1>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_parser_sourcefile@plt>
lea    0xec8(%rip),%rdx
lea    0xec3(%rip),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"octave\00"
@.str.1 = [10 x i8] c" %comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [9 x i8] c"%comment\00"
define void @test_octave_line_comment_1() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"octave\00"
@.str.1 = [10 x i8] c" %comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [9 x i8] c"%comment\00"
define void @test_octave_line_comment_1() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int nvidia_mcp_gpio_set(int, int /*<<< orphan*/);
int nvidia_mcp_gpio2_lower(void) { return nvidia_mcp_gpio_set(0x02, 0); }


x86 assembly (clang, -O0):
<nvidia_mcp_gpio2_lower>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <nvidia_mcp_gpio_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvidia_mcp_gpio2_lower>:
mov    $0x2,%edi
xor    %esi,%esi
jmp    1030 <nvidia_mcp_gpio_set@plt>

LLVM IR (-O0):
define i32 @nvidia_mcp_gpio2_lower() {
%1 = call i32 @nvidia_mcp_gpio_set(i32 2, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @nvidia_mcp_gpio2_lower() {
%1 = tail call i32 @nvidia_mcp_gpio_set(i32 2, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ remove_newline(char *);
char *remove_quote(int /*<<< orphan*/);
char *clean_string(char *p) { return remove_quote(remove_newline(p)); }


x86 assembly (clang, -O0):
<clean_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <remove_newline@plt>
mov    %eax,%edi
call   1030 <remove_quote@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_string>:
push   %rax
call   1040 <remove_newline@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <remove_quote@plt>

LLVM IR (-O0):
define i8* @clean_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @remove_newline(i8* %3)
%5 = call i8* @remove_quote(i32 %4)
ret i8* %5
}

LLVM IR (-O2):
define i8* @clean_string(i8* %0) {
%2 = tail call i32 @remove_newline(i8* %0)
%3 = tail call i8* @remove_quote(i32 %2)
ret i8* %3
}
/* Variables and functions */
int i2c_smbus_read_word_data(int, int);
int i2c_rw(int fd, int reg) {
  int x;
  if ((x = i2c_smbus_read_word_data(fd, reg)) < 0)
    return (-1);
  return (((x & 0xff) << 8) + ((x & 0xff00) >> 8));
}


x86 assembly (clang, -O0):
<i2c_rw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <i2c_smbus_read_word_data@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    1141 <i2c_rw+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <i2c_rw+0x4d>
mov    -0x10(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_rw>:
push   %rax
call   1030 <i2c_smbus_read_word_data@plt>
mov    %eax,%ecx
rol    $0x8,%cx
movzwl %cx,%ecx
test   %eax,%eax
mov    $0xffffffff,%eax
cmovns %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @i2c_rw(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
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @i2c_smbus_read_word_data(i32 %7, i32 %8)
store i32 %9, i32* %6
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %20
12: ; preds = %2
%13 = load i32, i32* %6
%14 = and i32 %13, 255
%15 = shl i32 %14, 8
%16 = load i32, i32* %6
%17 = and i32 %16, 65280
%18 = ashr i32 %17, 8
%19 = add nsw i32 %15, %18
store i32 %19, i32* %3
br label %20
20: ; preds = %12, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @i2c_rw(i32 %0, i32 %1) {
%3 = tail call i32 @i2c_smbus_read_word_data(i32 %0, i32 %1)
%4 = trunc i32 %3 to i16
%5 = tail call i16 @llvm.bswap.i16(i16 %4)
%6 = zext i16 %5 to i32
%7 = icmp sgt i32 %3, -1
%8 = select i1 %7, i32 %6, i32 -1
ret i32 %8
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
int sqlite3UnixCurrentTime(double *prNow) {
  struct timeval sNow;
  struct timezone sTz;
  gettimeofday(&sNow, &sTz);
  *prNow = 2440587.5 + sNow.tv_sec / 86400.0 + sNow.tv_usec / 86400000000.0;
  return 0;
}


x86 assembly (clang, -O0):
<sqlite3UnixCurrentTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <gettimeofday@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xeda(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xec6(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xead(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3UnixCurrentTime>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
divsd  0xec5(%rip),%xmm0
addsd  0xec5(%rip),%xmm0
divsd  0xec5(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
define i32 @sqlite3UnixCurrentTime(double* %0) {
%2 = alloca double*
%3 = alloca %struct.timeval
%4 = alloca %struct.timezone
store double* %0, double** %2
%5 = call i32 @gettimeofday(%struct.timeval* %3, %struct.timezone* %4)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%7 = load double, double* %6
%8 = fdiv double %7, 8.640000e+04
%9 = fadd double 0x41429EC5C0000000, %8
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%11 = load double, double* %10
%12 = fdiv double %11, 8.640000e+10
%13 = fadd double %9, %12
%14 = load double*, double** %2
store double %13, double* %14
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
define i32 @sqlite3UnixCurrentTime(double* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = alloca %struct.timezone
%4 = bitcast %struct.timeval* %2 to i8*
%5 = bitcast %struct.timezone* %3 to i8*
%6 = call i32 @gettimeofday(%struct.timeval* %2, %struct.timezone* %3)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%8 = load double, double* %7
%9 = fdiv double %8, 8.640000e+04
%10 = fadd double %9, 0x41429EC5C0000000
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%12 = load double, double* %11
%13 = fdiv double %12, 8.640000e+10
%14 = fadd double %10, %13
store double %14, double* %0
ret i32 0
}
/* Variables and functions */
int create(char *);
char *getStatusText(int const);
int /*<<< orphan*/ printf(char *, char *, char *);
int create_log(char filename[]) {
  const int status = create(filename);
  printf("CREATE FILE \"%s\": %s\n", filename, getStatusText(status));
  return status;
}


x86 assembly (clang, -O0):
<create_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <create@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <getStatusText@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_log>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <create@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <getStatusText@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"CREATE FILE \22%s\22: %s\0A\00"
define i32 @create_log(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @create(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i8* @getStatusText(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %8)
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@.str = [22 x i8] c"CREATE FILE \22%s\22: %s\0A\00"
define i32 @create_log(i8* %0) {
%2 = tail call i32 @create(i8* %0)
%3 = tail call i8* @getStatusText(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ displayRegion();
int /*<<< orphan*/ generateContentsVector();
void uploadRegion() {
  generateContentsVector();
  displayRegion();
}


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

x86 assembly (clang, -O2):
<uploadRegion>:
push   %rax
xor    %eax,%eax
call   1030 <generateContentsVector@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <displayRegion@plt>

LLVM IR (-O0):
define void @uploadRegion() {
%1 = call i32 (...) @generateContentsVector()
%2 = call i32 (...) @displayRegion()
ret void
}

LLVM IR (-O2):
define void @uploadRegion() {
%1 = tail call i32 (...) @generateContentsVector()
%2 = tail call i32 (...) @displayRegion()
ret void
}
int test_imm_E8uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xE8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_E8uint64_lowword_mem>:
testb  $0xe8,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E8uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 232
%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_E8uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 232
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
double doubles_sum(double *, int);
double int_max(int, int);
double doubles_mean(double *farr, int size) {
  return (doubles_sum(farr, size) / int_max(size, 1));
}


x86 assembly (clang, -O0):
<doubles_mean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <doubles_sum@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1040 <int_max@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubles_mean>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
call   1030 <doubles_sum@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <int_max@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @doubles_mean(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = call double @doubles_sum(double* %5, i32 %6)
%8 = load i32, i32* %4
%9 = call double @int_max(i32 %8, i32 1)
%10 = fdiv double %7, %9
ret double %10
}

LLVM IR (-O2):
define double @doubles_mean(double* %0, i32 %1) {
%3 = tail call double @doubles_sum(double* %0, i32 %1)
%4 = tail call double @int_max(i32 %1, i32 1)
%5 = fdiv double %3, %4
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
void writeb(uint8_t value, uint32_t addr) {
  *((volatile uint8_t *)addr) = value;
}


x86 assembly (clang, -O0):
<writeb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeb>:
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @writeb(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = load i64, i64* %4
%7 = inttoptr i64 %6 to i32*
store volatile i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @writeb(i32 %0, i64 %1) {
%3 = inttoptr i64 %1 to i32*
store volatile i32 %0, i32* %3
ret void
}
void i2c_delay_about_5us_x(int n) {
  volatile int i, j;
  for (j = 0; j < n; j++) {
    for (i = 0; i < 7; i++)
      ;
  }
}


x86 assembly (clang, -O0):
<i2c_delay_about_5us_x>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1153 <i2c_delay_about_5us_x+0x53>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x7,%eax
jge    1140 <i2c_delay_about_5us_x+0x40>
jmp    1132 <i2c_delay_about_5us_x+0x32>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <i2c_delay_about_5us_x+0x21>
jmp    1145 <i2c_delay_about_5us_x+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <i2c_delay_about_5us_x+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_delay_about_5us_x>:
movl   $0x0,-0x8(%rsp)
jmp    1115 <i2c_delay_about_5us_x+0x15>
nopw   0x0(%rax,%rax,1)
addl   $0x1,-0x8(%rsp)
mov    -0x8(%rsp),%eax
cmp    %edi,%eax
jge    1140 <i2c_delay_about_5us_x+0x40>
movl   $0x0,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x6,%eax
jg     1110 <i2c_delay_about_5us_x+0x10>
xchg   %ax,%ax
addl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x7,%eax
jl     1130 <i2c_delay_about_5us_x+0x30>
jmp    1110 <i2c_delay_about_5us_x+0x10>
ret

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

LLVM IR (-O2):
define void @i2c_delay_about_5us_x(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store volatile i32 0, i32* %3
%6 = load volatile i32, i32* %3
%7 = icmp slt i32 %6, %0
br i1 %7, label %8, label %21
8: ; preds = %1, %16
store volatile i32 0, i32* %2
%9 = load volatile i32, i32* %2
%10 = icmp slt i32 %9, 7
br i1 %10, label %11, label %16
11: ; preds = %8, %11
%12 = load volatile i32, i32* %2
%13 = add nsw i32 %12, 1
store volatile i32 %13, i32* %2
%14 = load volatile i32, i32* %2
%15 = icmp slt i32 %14, 7
br i1 %15, label %11, label %16
16: ; preds = %11, %8
%17 = load volatile i32, i32* %3
%18 = add nsw i32 %17, 1
store volatile i32 %18, i32* %3
%19 = load volatile i32, i32* %3
%20 = icmp slt i32 %19, %0
br i1 %20, label %8, label %21
21: ; preds = %16, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test6();
void test7() { test6(); }


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

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

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

LLVM IR (-O2):
define void @test7() {
%1 = tail call i32 (...) @test6()
ret void
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("started califax. For Doreen.\n");
  return close(-11);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffff5,%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffffff5,%edi
pop    %rax
jmp    1040 <close@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"started califax. For Doreen.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @close(i32 -11)
ret i32 %3
}

LLVM IR (-O2):
@str = [29 x i8] c"started califax. For Doreen.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @close(i32 -11)
ret i32 %2
}
__attribute__((always_)) void XRayEndFrame() { ; }


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

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

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

LLVM IR (-O2):
define void @XRayEndFrame() {
ret void
}
/* Variables and functions */
int bar();
int foo(void) { return 10 + bar(); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bar@plt>
add    $0xa,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
add    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = call i32 (...) @bar()
%2 = add nsw i32 10, %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 (...) @bar()
%2 = add nsw i32 %1, 10
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void msgbox(char *msg) { printf("msgbox(%s)\n", msg); }


x86 assembly (clang, -O0):
<msgbox>:
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):
<msgbox>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"msgbox(%s)\0A\00"
define void @msgbox(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int p3_next_seq(seq)
int seq;
{ return p3_add_seq(seq, 1); }


x86 assembly (clang, -O0):
<p3_next_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <p3_add_seq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p3_next_seq>:
mov    $0x1,%esi
xor    %eax,%eax
jmp    1030 <p3_add_seq@plt>

LLVM IR (-O0):
define i32 @p3_next_seq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, i32, ...) bitcast (i32 (...)* @p3_add_seq to i32 (i32, i32, ...)*)(i32 %3, i32 1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @p3_next_seq(i32 %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @p3_add_seq to i32 (i32, i32, ...)*)(i32 %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ test();
int main(int argc, const char *argv[]) {
#pragma unused(argc, argv)
  test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test@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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test()
ret i32 0
}
/* Variables and functions */
scalar_t__ exp(double);
float db2magf(double dB) {
  const double DB_2_LOG = 0.11512925464970228420089957273422;
  return (float)exp(dB * DB_2_LOG);
}


x86 assembly (clang, -O0):
<db2magf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xece(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db2magf>:
push   %rax
mulsd  0xee7(%rip),%xmm0
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @db2magf(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0x3FBD791C5F888822, double* %3
%4 = load double, double* %2
%5 = fmul double %4, 0x3FBD791C5F888822
%6 = call i64 @exp(double %5)
%7 = sitofp i64 %6 to float
ret float %7
}

LLVM IR (-O2):
define float @db2magf(double %0) {
%2 = fmul double %0, 0x3FBD791C5F888822
%3 = tail call i64 @exp(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ unset_bit(int *, int);
void unset(int *numbers, int number) {
  int index = number >> 5;
  unset_bit(numbers + index, number - (index << 5));
}


x86 assembly (clang, -O0):
<unset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x5,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
sub    %eax,%esi
call   1030 <unset_bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unset>:
mov    %esi,%eax
sar    $0x5,%eax
cltq
lea    (%rdi,%rax,4),%rdi
and    $0x1f,%esi
jmp    1030 <unset_bit@plt>

LLVM IR (-O0):
define void @unset(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = ashr i32 %6, 5
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = shl i32 %13, 5
%15 = sub nsw i32 %12, %14
%16 = call i32 @unset_bit(i32* %11, i32 %15)
ret void
}

LLVM IR (-O2):
define void @unset(i32* %0, i32 %1) {
%3 = ashr i32 %1, 5
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = and i32 %1, 31
%7 = tail call i32 @unset_bit(i32* %5, i32 %6)
ret void
}