xunge/DecIR huggingface dataset:
/* Variables and functions */
int PAPI_stop(int, long long *);
void papif_stop__(int *EventSet, long long *values, int *check) {
  *check = PAPI_stop(*EventSet, values);
}


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

x86 assembly (clang, -O2):
<papif_stop__>:
push   %rbx
mov    %rdx,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_stop@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @papif_stop__(i32* %0, i64* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i32*
store i32* %0, i32** %4
store i64* %1, i64** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = load i64*, i64** %5
%10 = call i32 @PAPI_stop(i32 %8, i64* %9)
%11 = load i32*, i32** %6
store i32 %10, i32* %11
ret void
}

LLVM IR (-O2):
define void @papif_stop__(i32* nocapture %0, i64* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @PAPI_stop(i32 %4, i64* %1)
store i32 %5, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arrangepieces();
int /*<<< orphan*/ setaddressnames();
int /*<<< orphan*/ setpiecenames();
int /*<<< orphan*/ verifypiecetypes();
void processcontents(void) {
  arrangepieces();
  verifypiecetypes();
  setpiecenames();
  setaddressnames();
}


x86 assembly (clang, -O0):
<processcontents>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <arrangepieces@plt>
mov    $0x0,%al
call   1050 <verifypiecetypes@plt>
mov    $0x0,%al
call   1060 <setpiecenames@plt>
mov    $0x0,%al
call   1030 <setaddressnames@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<processcontents>:
push   %rax
xor    %eax,%eax
call   1040 <arrangepieces@plt>
xor    %eax,%eax
call   1050 <verifypiecetypes@plt>
xor    %eax,%eax
call   1060 <setpiecenames@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <setaddressnames@plt>

LLVM IR (-O0):
define void @processcontents() {
%1 = call i32 (...) @arrangepieces()
%2 = call i32 (...) @verifypiecetypes()
%3 = call i32 (...) @setpiecenames()
%4 = call i32 (...) @setaddressnames()
ret void
}

LLVM IR (-O2):
define void @processcontents() {
%1 = tail call i32 (...) @arrangepieces()
%2 = tail call i32 (...) @verifypiecetypes()
%3 = tail call i32 (...) @setpiecenames()
%4 = tail call i32 (...) @setaddressnames()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mdea_error(char **, char *);
int mdea_number_node_get_boolean(void *p, int *boolean, char **error) {
  mdea_error(error, "Expected boolean, got number");
  return -1;
}


x86 assembly (clang, -O0):
<mdea_number_node_get_boolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <mdea_error@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdea_number_node_get_boolean>:
push   %rax
mov    %rdx,%rdi
lea    0xee5(%rip),%rsi
call   1030 <mdea_error@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Expected boolean, got number\00"
define i32 @mdea_number_node_get_boolean(i8* %0, i32* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8**
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8** %2, i8*** %6
%7 = load i8**, i8*** %6
%8 = call i32 @mdea_error(i8** %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [29 x i8] c"Expected boolean, got number\00"
define i32 @mdea_number_node_get_boolean(i8* nocapture readnone %0, i32* nocapture readnone %1, i8** %2) {
%4 = tail call i32 @mdea_error(i8** %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
int test_imm_5Aint16_mem(short *val) {
  return ((*val) & (-0x5A << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_5Aint16_mem>:
movzwl (%rdi),%eax
test   $0xffa6,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Aint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -90
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int rand();
void main() {
  int a;
  while (1) {
    a = rand() * rand();
    if (a == 41) {
    ERROR:
      return;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x29,-0x4(%rbp)
jne    1149 <main+0x39>
jmp    1143 <main+0x33>
add    $0x10,%rsp
pop    %rbp
ret
jmp    1118 <main+0x8>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
imul   %ebx,%eax
cmp    $0x29,%eax
jne    1120 <main+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
br label %2
2: ; preds = %0, %10
%3 = call i32 (...) @rand()
%4 = call i32 (...) @rand()
%5 = mul nsw i32 %3, %4
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 41
br i1 %7, label %8, label %10
8: ; preds = %2
br label %9
9: ; preds = %8
ret void
10: ; preds = %2
br label %2
}

LLVM IR (-O2):
define void @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @rand()
%3 = tail call i32 (...) @rand()
%4 = mul nsw i32 %3, %2
%5 = icmp eq i32 %4, 41
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void add_token(char *token_char) { printf("%s,", token_char); }


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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s,\00"
define void @add_token(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int f(int);
int main() {
  int b;
  int a = 2;
  b = a + f(3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @f(i32 3)
%6 = add nsw i32 %4, %5
store i32 %6, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
ret i32 0
}
char *fid_version() { return "0.9.10"; }


x86 assembly (clang, -O0):
<fid_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fid_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"0.9.10\00"
define i8* @fid_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"0.9.10\00"
define i8* @fid_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *);
void qmi_message_emit_message_type(FILE *fp, const char *package,
                                   const char *message) {
  fprintf(fp, "struct %s_%s;\n", package, message);
}


x86 assembly (clang, -O0):
<qmi_message_emit_message_type>:
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),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qmi_message_emit_message_type>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"struct %s_%s;\0A\00"
define void @qmi_message_emit_message_type(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"struct %s_%s;\0A\00"
define void @qmi_message_emit_message_type(i32* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fscanf(int /*<<< orphan*/ *, char *, int *);
int zomp_readInt(void *file, int *val) {
  return fscanf((FILE *)file, "%d", val);
}


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

x86 assembly (clang, -O2):
<zomp_readInt>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fscanf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @zomp_readInt(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32*, i32** %4
%8 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @zomp_readInt(i8* nocapture %0, i32* %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ lexo(char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n;
  char *st;
  scanf("%d", &n);
  st = (char *)malloc((n + 1) * sizeof(char));
  *(st + 1) = '\0';
  scanf("%s", st);
  lexo(st, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <lexo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,0x1(%rax)
lea    0xea1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <lexo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8 0, i8* %13
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %3
%17 = load i32, i32* %2
%18 = call i32 @lexo(i8* %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 0, i8* %8
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%10 = load i32, i32* %1
%11 = call i32 @lexo(i8* %7, i32 %10)
ret i32 0
}
long long int f2(int n, int m) {
  int vmin, vmax;
  vmin = (n + 1) / 2;
  if (m < vmin)
    return 0;
  vmax = (m < n - 1 ? m : n - 1);
  return (vmax - vmin) * 2 + 1 + (n % 2);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1134 <f2+0x34>
movq   $0x0,-0x8(%rbp)
jmp    1184 <f2+0x84>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1150 <f2+0x50>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <f2+0x59>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
add    %edx,%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
lea    0x1(%rdi),%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0x1,%eax
sar    %eax
cmp    %esi,%eax
jle    1114 <f2+0x14>
xor    %eax,%eax
ret
lea    -0x1(%rdi),%ecx
cmp    %esi,%ecx
cmovg  %esi,%ecx
sub    %eax,%ecx
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
and    $0xfffffffe,%eax
sub    %eax,%edi
lea    (%rdi,%rcx,2),%eax
add    $0x1,%eax
cltq
ret

LLVM IR (-O0):
define i64 @f2(i32 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = sdiv i32 %9, 2
store i32 %10, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %2
store i64 0, i64* %3
br label %36
15: ; preds = %2
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = load i32, i32* %5
br label %25
22: ; preds = %15
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
br label %25
25: ; preds = %22, %20
%26 = phi i32 [ %21, %20 ], [ %24, %22 ]
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = sub nsw i32 %27, %28
%30 = mul nsw i32 %29, 2
%31 = add nsw i32 %30, 1
%32 = load i32, i32* %4
%33 = srem i32 %32, 2
%34 = add nsw i32 %31, %33
%35 = sext i32 %34 to i64
store i64 %35, i64* %3
br label %36
36: ; preds = %25, %14
%37 = load i64, i64* %3
ret i64 %37
}

LLVM IR (-O2):
define i64 @f2(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = sdiv i32 %3, 2
%5 = icmp sgt i32 %4, %1
br i1 %5, label %16, label %6
6: ; preds = %2
%7 = add nsw i32 %0, -1
%8 = icmp sgt i32 %7, %1
%9 = select i1 %8, i32 %1, i32 %7
%10 = sub nsw i32 %9, %4
%11 = shl nsw i32 %10, 1
%12 = srem i32 %0, 2
%13 = add nsw i32 %12, 1
%14 = add i32 %13, %11
%15 = sext i32 %14 to i64
br label %16
16: ; preds = %2, %6
%17 = phi i64 [ %15, %6 ], [ 0, %2 ]
ret i64 %17
}
message(s, a, b, c) char *s, *a, *b, *c;
{
  printf(s, a, b, c);
  printf("\n");
}


x86 assembly (clang, -O0):
<message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<message>:
push   %rax
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @message(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = load i8*, i8** %9
%14 = call i32 (i8*, ...) @printf(i8* %10, i8* %11, i8* %12, i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @message(i8* nocapture %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0, i8* %1, i8* %2, i8* %3)
%6 = tail call i32 @putchar(i32 10)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int EOF;
int next();
int skip(uint8_t n) {
  int c = 0;
  while (n-- && c != EOF)
    c = next();
  return c;
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     114d <skip+0x3d>
mov    -0x8(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115d <skip+0x4d>
jmp    116c <skip+0x5c>
mov    $0x0,%al
call   1030 <next@plt>
mov    %eax,-0x8(%rbp)
jmp    1122 <skip+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %edi,%edi
je     1141 <skip+0x31>
mov    0x2ec7(%rip),%r14
cmpl   $0x0,(%r14)
je     1141 <skip+0x31>
mov    %edi,%ebx
add    $0xffffffff,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <next@plt>
add    $0xffffffff,%ebx
jae    1141 <skip+0x31>
cmp    (%r14),%eax
jne    1130 <skip+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @skip(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %3, 0
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %6, label %14
6: ; preds = %1, %6
%7 = phi i32 [ %8, %6 ], [ %0, %1 ]
%8 = add nsw i32 %7, -1
%9 = tail call i32 (...) @next()
%10 = icmp ne i32 %8, 0
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %9, %11
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %6, label %14
14: ; preds = %6, %1
%15 = phi i32 [ 0, %1 ], [ %9, %6 ]
ret i32 %15
}
unsigned add32_with_carry(unsigned a, unsigned b) {
  asm("addl %2,%0\n\t"
      "adcl $0,%0"
      : "=r"(a)
      : "0"(a), "rm"(b));
  return a;
}


x86 assembly (clang, -O0):
<add32_with_carry>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,-0xc(%rbp)
add    -0xc(%rbp),%eax
adc    $0x0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add32_with_carry>:
mov    %edi,%eax
mov    %esi,-0x4(%rsp)
add    -0x4(%rsp),%eax
adc    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @add32_with_carry(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 = load i32, i32* %4
%7 = call i32 asm "addl $2,$0\0A\09adcl $$0,$0", "=r,0,rm,~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @add32_with_carry(i32 %0, i32 %1) {
%3 = tail call i32 asm "addl $2,$0\0A\09adcl $$0,$0", "=r,0,rm,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
ret i32 %3
}
unsigned long long unhex(const char *restrict cp) {
  unsigned long long ull = 0;
  for (;;) {
    char c = *cp++;
    if (__builtin_expect(!!(c < 0x30), 0))
      break;
    ull = (ull << 4) | (c - (c > 0x57) ? 0x57 : 0x30);
  }
  return ull;
}


x86 assembly (clang, -O0):
<unhex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x30,%eax
setl   %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
je     1148 <unhex+0x48>
jmp    1185 <unhex+0x85>
mov    -0x10(%rbp),%rax
shl    $0x4,%rax
movsbl -0x11(%rbp),%esi
movsbl -0x11(%rbp),%ecx
cmp    $0x57,%ecx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%esi
mov    $0x30,%ecx
mov    $0x57,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <unhex+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unhex>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rcx,%rax
shl    $0x4,%rcx
or     $0x57,%rcx
cmpb   $0x2f,(%rdi)
lea    0x1(%rdi),%rdi
jg     1110 <unhex+0x10>
ret

LLVM IR (-O0):
define i64 @unhex(i8* noalias %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8
store i8* %0, i8** %2
store i64 0, i64* %3
br label %5
5: ; preds = %18, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = icmp slt i32 %10, 48
%12 = xor i1 %11, true
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
%15 = sext i32 %14 to i64
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %5
br label %33
18: ; preds = %5
%19 = load i64, i64* %3
%20 = shl i64 %19, 4
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
%25 = icmp sgt i32 %24, 87
%26 = zext i1 %25 to i32
%27 = sub nsw i32 %22, %26
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 87, i32 48
%31 = sext i32 %30 to i64
%32 = or i64 %20, %31
store i64 %32, i64* %3
br label %5
33: ; preds = %17
%34 = load i64, i64* %3
ret i64 %34
}

LLVM IR (-O2):
define i64 @unhex(i8* noalias nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %9, %2 ]
%4 = phi i8* [ %0, %1 ], [ %5, %2 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp slt i8 %6, 48
%8 = shl i64 %3, 4
%9 = or i64 %8, 87
br i1 %7, label %10, label %2
10: ; preds = %2
ret i64 %3
}
unsigned long sys_timer_get_counter(void) {
  volatile unsigned int *counter_low_ptr = (unsigned int *)(0x20003000 + 4);
  volatile unsigned int *counter_high_ptr = 0x20003000 + 8;
  unsigned int counter_hi = *counter_high_ptr;
  unsigned int counter_low = *counter_low_ptr;
  unsigned int new_counter_hi = *counter_high_ptr;
  unsigned long result;
  if (new_counter_hi != counter_hi)
    counter_low = *counter_low_ptr;
  result = new_counter_hi;
  result <<= 32;
  result += counter_low;
  return result;
}


x86 assembly (clang, -O0):
<sys_timer_get_counter>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20003004,%eax
mov    %rax,-0x8(%rbp)
mov    $0x20003008,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1146 <sys_timer_get_counter+0x46>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
shl    $0x20,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_timer_get_counter>:
mov    0x20003008,%edx
mov    0x20003004,%eax
mov    0x20003008,%ecx
cmp    %edx,%ecx
je     1120 <sys_timer_get_counter+0x20>
mov    0x20003004,%eax
shl    $0x20,%rcx
mov    %eax,%eax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @sys_timer_get_counter() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32* inttoptr (i64 536883204 to i32*), i32** %1
store i32* inttoptr (i64 536883208 to i32*), i32** %2
%7 = load i32*, i32** %2
%8 = load volatile i32, i32* %7
store i32 %8, i32* %3
%9 = load i32*, i32** %1
%10 = load volatile i32, i32* %9
store i32 %10, i32* %4
%11 = load i32*, i32** %2
%12 = load volatile i32, i32* %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load i32*, i32** %1
%18 = load volatile i32, i32* %17
store i32 %18, i32* %4
br label %19
19: ; preds = %16, %0
%20 = load i32, i32* %5
%21 = zext i32 %20 to i64
store i64 %21, i64* %6
%22 = load i64, i64* %6
%23 = shl i64 %22, 32
store i64 %23, i64* %6
%24 = load i32, i32* %4
%25 = zext i32 %24 to i64
%26 = load i64, i64* %6
%27 = add i64 %26, %25
store i64 %27, i64* %6
%28 = load i64, i64* %6
ret i64 %28
}

LLVM IR (-O2):
define i64 @sys_timer_get_counter() {
%1 = load volatile i32, i32* inttoptr (i64 536883208 to i32*)
%2 = load volatile i32, i32* inttoptr (i64 536883204 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 536883208 to i32*)
%4 = icmp eq i32 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = load volatile i32, i32* inttoptr (i64 536883204 to i32*)
br label %7
7: ; preds = %5, %0
%8 = phi i32 [ %6, %5 ], [ %2, %0 ]
%9 = zext i32 %3 to i64
%10 = shl nuw i64 %9, 32
%11 = zext i32 %8 to i64
%12 = or i64 %10, %11
ret i64 %12
}
void copy_numbers(struct inhalt *data, float *numbers, int columns, int rows) {}


x86 assembly (clang, -O0):
<copy_numbers>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.inhalt = type opaque
define void @copy_numbers(%struct.inhalt* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca %struct.inhalt*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
store %struct.inhalt* %0, %struct.inhalt** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
%struct.inhalt = type opaque
define void @copy_numbers(%struct.inhalt* nocapture %0, float* nocapture %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
size_t write(int, char *, size_t);
void send_data(int socket, void *buffer, size_t bytes) {
  size_t sofar, remaining, len;
  char *buf;
  buf = buffer;
  sofar = 0;
  remaining = bytes;
  do {
    len = write(socket, buf + sofar, remaining);
    sofar += len;
    remaining -= len;
  } while (remaining > 0);
}


x86 assembly (clang, -O0):
<send_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x38(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
ja     113b <send_data+0x2b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r14,%rbp,1),%rsi
mov    %r15d,%edi
mov    %rbx,%rdx
call   1030 <write@plt>
add    %rax,%rbp
sub    %rax,%rbx
jne    1130 <send_data+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @send_data(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%11 = load i8*, i8** %5
store i8* %11, i8** %10
store i64 0, i64* %7
%12 = load i64, i64* %6
store i64 %12, i64* %8
br label %13
13: ; preds = %26, %3
%14 = load i32, i32* %4
%15 = load i8*, i8** %10
%16 = load i64, i64* %7
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i64, i64* %8
%19 = call i64 @write(i32 %14, i8* %17, i64 %18)
store i64 %19, i64* %9
%20 = load i64, i64* %9
%21 = load i64, i64* %7
%22 = add i64 %21, %20
store i64 %22, i64* %7
%23 = load i64, i64* %9
%24 = load i64, i64* %8
%25 = sub i64 %24, %23
store i64 %25, i64* %8
br label %26
26: ; preds = %13
%27 = load i64, i64* %8
%28 = icmp ugt i64 %27, 0
br i1 %28, label %13, label %29
29: ; preds = %26
ret void
}

LLVM IR (-O2):
define void @send_data(i32 %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i64 [ %2, %3 ], [ %10, %4 ]
%6 = phi i64 [ 0, %3 ], [ %9, %4 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = tail call i64 @write(i32 %0, i8* %7, i64 %5)
%9 = add i64 %8, %6
%10 = sub i64 %5, %8
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4
ret void
}
/* Type definitions */
struct key {
  int dummy;
};

/* Variables and functions */
int le_key_k_offset(int, struct key *);
int le_key_version(struct key *);
int indirect_is_left_mergeable(struct key *key, unsigned long bsize) {
  int version = le_key_version(key);
  return (le_key_k_offset(version, key) != 1);
}


x86 assembly (clang, -O0):
<indirect_is_left_mergeable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <le_key_version@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <le_key_k_offset@plt>
cmp    $0x1,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indirect_is_left_mergeable>:
push   %rbx
mov    %rdi,%rbx
call   1040 <le_key_version@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <le_key_k_offset@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.key = type { i32 }
define i32 @indirect_is_left_mergeable(%struct.key* %0, i64 %1) {
%3 = alloca %struct.key*
%4 = alloca i64
%5 = alloca i32
store %struct.key* %0, %struct.key** %3
store i64 %1, i64* %4
%6 = load %struct.key*, %struct.key** %3
%7 = call i32 @le_key_version(%struct.key* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load %struct.key*, %struct.key** %3
%10 = call i32 @le_key_k_offset(i32 %8, %struct.key* %9)
%11 = icmp ne i32 %10, 1
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
%struct.key = type { i32 }
define i32 @indirect_is_left_mergeable(%struct.key* %0, i64 %1) {
%3 = tail call i32 @le_key_version(%struct.key* %0)
%4 = tail call i32 @le_key_k_offset(i32 %3, %struct.key* %0)
%5 = icmp ne i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
double RAND_MAX;
double rand();
int rand_range(int s, int e) {
  int sp = e - s;
  int d = (0.1 + rand()) / (RAND_MAX + 1.0) * sp;
  return d + s;
}


x86 assembly (clang, -O0):
<rand_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  0xecf(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xebb(%rip),%xmm1
mov    0x2e9c(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
sub    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
addsd  0xed8(%rip),%xmm0
mov    0x2eb9(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xecd(%rip),%xmm1
divsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @rand_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %5
%10 = call double (...) @rand()
%11 = fadd double 1.000000e-01, %10
%12 = load double, double* @RAND_MAX
%13 = fadd double %12, 1.000000e+00
%14 = fdiv double %11, %13
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = fmul double %14, %16
%18 = fptosi double %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
ret i32 %21
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @rand_range(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = tail call double (...) @rand()
%5 = fadd double %4, 1.000000e-01
%6 = load double, double* @RAND_MAX
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %5, %7
%9 = sitofp i32 %3 to double
%10 = fmul double %8, %9
%11 = fptosi double %10 to i32
%12 = add nsw i32 %11, %0
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ OAL_OBTAIN_SEMAPHORE();
int /*<<< orphan*/ OAL_RELEASE_SEMAPHORE();
int spi_bulkwrite(void *, unsigned short, unsigned char, unsigned char *, int);
int fc8150_spib_wordwrite(void *hDevice, unsigned short addr,
                          unsigned int data) {
  int res;
  unsigned char command = 0x00 | 0x80;
  OAL_OBTAIN_SEMAPHORE();
  res = spi_bulkwrite(hDevice, addr, command, (unsigned char *)&data, 2);
  OAL_RELEASE_SEMAPHORE();
  return res;
}


x86 assembly (clang, -O0):
<fc8150_spib_wordwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
movb   $0x80,-0x15(%rbp)
mov    $0x0,%al
call   1050 <OAL_OBTAIN_SEMAPHORE@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%dx
mov    -0x15(%rbp),%al
lea    -0x10(%rbp),%rcx
mov    $0x2,%r8d
movzwl %dx,%esi
movzbl %al,%edx
call   1040 <spi_bulkwrite@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <OAL_RELEASE_SEMAPHORE@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fc8150_spib_wordwrite>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %edx,0x4(%rsp)
xor    %eax,%eax
call   1050 <OAL_OBTAIN_SEMAPHORE@plt>
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x80,%edx
mov    $0x2,%r8d
call   1040 <spi_bulkwrite@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <OAL_RELEASE_SEMAPHORE@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fc8150_spib_wordwrite(i8* %0, i16 zeroext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %4
store i16 %1, i16* %5
store i32 %2, i32* %6
store i8 -128, i8* %8
%9 = call i32 (...) @OAL_OBTAIN_SEMAPHORE()
%10 = load i8*, i8** %4
%11 = load i16, i16* %5
%12 = load i8, i8* %8
%13 = bitcast i32* %6 to i8*
%14 = call i32 @spi_bulkwrite(i8* %10, i16 zeroext %11, i8 zeroext %12, i8* %13, i32 2)
store i32 %14, i32* %7
%15 = call i32 (...) @OAL_RELEASE_SEMAPHORE()
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @fc8150_spib_wordwrite(i8* %0, i16 zeroext %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = tail call i32 (...) @OAL_OBTAIN_SEMAPHORE()
%6 = bitcast i32* %4 to i8*
%7 = call i32 @spi_bulkwrite(i8* %0, i16 zeroext %1, i8 zeroext -128, i8* %6, i32 2)
%8 = call i32 (...) @OAL_RELEASE_SEMAPHORE()
ret i32 %7
}
/* Type definitions */
struct fs_file {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fs_free(struct fs_file *);
void fs_close(struct fs_file *file) { fs_free(file); }


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

x86 assembly (clang, -O2):
<fs_close>:
jmp    1030 <fs_free@plt>

LLVM IR (-O0):
%struct.fs_file = type { i32 }
define void @fs_close(%struct.fs_file* %0) {
%2 = alloca %struct.fs_file*
store %struct.fs_file* %0, %struct.fs_file** %2
%3 = load %struct.fs_file*, %struct.fs_file** %2
%4 = call i32 @fs_free(%struct.fs_file* %3)
ret void
}

LLVM IR (-O2):
%struct.fs_file = type { i32 }
define void @fs_close(%struct.fs_file* %0) {
%2 = tail call i32 @fs_free(%struct.fs_file* %0)
ret void
}
/* Variables and functions */
int main(int /*<<< orphan*/);
int /*<<< orphan*/ sys_exit(int);
void _start() {
  int ex = main(0);
  sys_exit(ex);
}


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <main@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <sys_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start>:
push   %rax
xor    %edi,%edi
call   1040 <main@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <sys_exit@plt>

LLVM IR (-O0):
define void @_start() {
%1 = alloca i32
%2 = call i32 @main(i32 0)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @sys_exit(i32 %3)
ret void
}

LLVM IR (-O2):
define void @_start() {
%1 = tail call i32 @main(i32 0)
%2 = tail call i32 @sys_exit(i32 %1)
ret void
}
void gc_delfref(void *obj) { (void)obj; }


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

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

LLVM IR (-O0):
define void @gc_delfref(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @gc_delfref(i8* nocapture %0) {
ret void
}
int do_471() { return 471; }


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

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

LLVM IR (-O0):
define i32 @do_471() {
ret i32 471
}

LLVM IR (-O2):
define i32 @do_471() {
ret i32 471
}
int high(x, u) { return x / sqrt(u); }


x86 assembly (clang, -O0):
<high>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<high>:
cvtsi2sd %edi,%xmm2
cvtsi2sd %esi,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1128 <high+0x18>
sqrtsd %xmm0,%xmm0
jmp    113c <high+0x2c>
push   %rax
movsd  %xmm2,(%rsp)
call   1030 <sqrt@plt>
movsd  (%rsp),%xmm2
add    $0x8,%rsp
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%eax
ret

LLVM IR (-O0):
define i32 @high(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 = sitofp i32 %5 to double
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = call double @sqrt(double %8)
%10 = fdiv double %6, %9
%11 = fptosi double %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @high(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = sitofp i32 %1 to double
%5 = tail call double @sqrt(double %4)
%6 = fdiv double %3, %5
%7 = fptosi double %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int __feh;

/* Variables and functions */
int read(int, int *, int);
int beread32(int fd, int *c) {
  int r;
  r = read(fd, c, 4);
  do {
    int __feh = *c;
    if (!1)
      *c = *c;
    else
      *c = ((((__feh)&0xff000000) >> 24) | (((__feh)&0x00ff0000) >> 8) |
            (((__feh)&0x0000ff00) << 8) | (((__feh)&0x000000ff) << 24));
  } while (0);
  return r;
}


x86 assembly (clang, -O0):
<beread32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    -0x18(%rbp),%eax
and    $0xff0000,%eax
sar    $0x8,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%eax
and    $0xff00,%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beread32>:
push   %rbx
mov    %rsi,%rbx
mov    $0x4,%edx
call   1030 <read@plt>
mov    (%rbx),%ecx
bswap  %ecx
mov    %ecx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @beread32(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* %3
%8 = load i32*, i32** %4
%9 = call i32 @read(i32 %7, i32* %8, i32 4)
store i32 %9, i32* %5
br label %10
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = and i32 %13, -16777216
%15 = lshr i32 %14, 24
%16 = load i32, i32* %6
%17 = and i32 %16, 16711680
%18 = ashr i32 %17, 8
%19 = or i32 %15, %18
%20 = load i32, i32* %6
%21 = and i32 %20, 65280
%22 = shl i32 %21, 8
%23 = or i32 %19, %22
%24 = load i32, i32* %6
%25 = and i32 %24, 255
%26 = shl i32 %25, 24
%27 = or i32 %23, %26
%28 = load i32*, i32** %4
store i32 %27, i32* %28
br label %29
29: ; preds = %10
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @beread32(i32 %0, i32* nocapture %1) {
%3 = tail call i32 @read(i32 %0, i32* %1, i32 4)
%4 = load i32, i32* %1
%5 = tail call i32 @llvm.bswap.i32(i32 %4)
store i32 %5, i32* %1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int O_CREAT;
int O_TRUNC;
int O_WRONLY;
int open(char const *, int, int /*<<< orphan*/);
int creat(const char *path, mode_t mode) {
  return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
}


x86 assembly (clang, -O0):
<creat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
mov    0x2ec5(%rip),%rax
or     (%rax),%esi
mov    0x2eb4(%rip),%rax
or     (%rax),%esi
mov    -0xc(%rbp),%edx
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<creat>:
mov    0x2eb1(%rip),%rcx
mov    0x2eda(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    %esi,%edx
mov    0x2ec5(%rip),%rcx
or     (%rcx),%eax
mov    %eax,%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @creat(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_WRONLY
%7 = load i32, i32* @O_CREAT
%8 = or i32 %6, %7
%9 = load i32, i32* @O_TRUNC
%10 = or i32 %8, %9
%11 = load i32, i32* %4
%12 = call i32 @open(i8* %5, i32 %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @creat(i8* nocapture %0, i32 %1) {
%3 = load i32, i32* @O_WRONLY
%4 = load i32, i32* @O_CREAT
%5 = or i32 %4, %3
%6 = load i32, i32* @O_TRUNC
%7 = or i32 %5, %6
%8 = tail call i32 @open(i8* %0, i32 %7, i32 %1)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char const *, int /*<<< orphan*/);
int open_i2c_device(const char *i2c_character_device) {
  int fd = open(i2c_character_device, O_RDWR);
  return fd;
}


x86 assembly (clang, -O0):
<open_i2c_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_i2c_device>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @open_i2c_device(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDWR
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @open_i2c_device(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
ret i32 %3
}
/* Type definitions */
struct Ann {
  int dummy;
};

/* Variables and functions */
float AnnGlobalError(struct Ann *, float *);
int /*<<< orphan*/ AnnSetInput(struct Ann *, float *);
int /*<<< orphan*/ AnnSimulate(struct Ann *);
float AnnSimulateError(struct Ann *net, float *input, float *desired) {
  AnnSetInput(net, input);
  AnnSimulate(net);
  return AnnGlobalError(net, desired);
}


x86 assembly (clang, -O0):
<AnnSimulateError>:
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
call   1030 <AnnSetInput@plt>
mov    -0x8(%rbp),%rdi
call   1050 <AnnSimulate@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <AnnGlobalError@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AnnSimulateError>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <AnnSetInput@plt>
mov    %rbx,%rdi
call   1050 <AnnSimulate@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <AnnGlobalError@plt>

LLVM IR (-O0):
%struct.Ann = type { i32 }
define float @AnnSimulateError(%struct.Ann* %0, float* %1, float* %2) {
%4 = alloca %struct.Ann*
%5 = alloca float*
%6 = alloca float*
store %struct.Ann* %0, %struct.Ann** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load %struct.Ann*, %struct.Ann** %4
%8 = load float*, float** %5
%9 = call i32 @AnnSetInput(%struct.Ann* %7, float* %8)
%10 = load %struct.Ann*, %struct.Ann** %4
%11 = call i32 @AnnSimulate(%struct.Ann* %10)
%12 = load %struct.Ann*, %struct.Ann** %4
%13 = load float*, float** %6
%14 = call float @AnnGlobalError(%struct.Ann* %12, float* %13)
ret float %14
}

LLVM IR (-O2):
%struct.Ann = type { i32 }
define float @AnnSimulateError(%struct.Ann* %0, float* %1, float* %2) {
%4 = tail call i32 @AnnSetInput(%struct.Ann* %0, float* %1)
%5 = tail call i32 @AnnSimulate(%struct.Ann* %0)
%6 = tail call float @AnnGlobalError(%struct.Ann* %0, float* %2)
ret float %6
}