xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t hash_string(const char *string, size_t n_buckets) {
  size_t value = 0;
  unsigned char ch;
  for (; (ch = *string); string++)
    value = (value * 31 + ch) % n_buckets;
  return value;
}


x86 assembly (clang, -O0):
<hash_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
cmp    $0x0,%al
je     114e <hash_string+0x4e>
imul   $0x1f,-0x18(%rbp),%rax
movzbl -0x19(%rbp),%ecx
add    %rcx,%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <hash_string+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_string>:
mov    (%rdi),%al
test   %al,%al
je     1146 <hash_string+0x46>
add    $0x1,%rdi
xor    %edx,%edx
jmp    1120 <hash_string+0x20>
xchg   %ax,%ax
xor    %edx,%edx
div    %rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1142 <hash_string+0x42>
mov    %rdx,%rcx
shl    $0x5,%rcx
sub    %rdx,%rcx
movzbl %al,%eax
add    %rcx,%rax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
jne    1110 <hash_string+0x10>
xor    %edx,%edx
div    %esi
jmp    1115 <hash_string+0x15>
mov    %rdx,%rax
ret
xor    %edx,%edx
mov    %rdx,%rax
ret

LLVM IR (-O0):
define i64 @hash_string(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %7
7: ; preds = %19, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
store i8 %9, i8* %6
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i64, i64* %5
%13 = mul i64 %12, 31
%14 = load i8, i8* %6
%15 = zext i8 %14 to i64
%16 = add i64 %13, %15
%17 = load i64, i64* %4
%18 = urem i64 %16, %17
store i64 %18, i64* %5
br label %19
19: ; preds = %11
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %7
22: ; preds = %7
%23 = load i64, i64* %5
ret i64 %23
}

LLVM IR (-O2):
define i64 @hash_string(i8* nocapture %0, i64 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i8* [ %13, %5 ], [ %0, %2 ]
%8 = phi i64 [ %12, %5 ], [ 0, %2 ]
%9 = mul i64 %8, 31
%10 = zext i8 %6 to i64
%11 = add i64 %9, %10
%12 = urem i64 %11, %1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i64 [ 0, %2 ], [ %12, %5 ]
ret i64 %17
}
int isone(int *x) { return x[0] == 1 && x[1] == 1; }


x86 assembly (clang, -O0):
<isone>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x1,(%rcx)
mov    %al,-0x9(%rbp)
jne    1128 <isone+0x28>
mov    -0x8(%rbp),%rax
cmpl   $0x1,0x4(%rax)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isone>:
xor    %eax,%eax
cmpl   $0x1,(%rdi)
jne    1110 <isone+0x10>
xor    %eax,%eax
cmpl   $0x1,0x4(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @isone(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 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 1
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @isone(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %4, %1
%10 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %10
}
int test_imm_C0int16_reg(short val) {
  return ((val) & (-0xC0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C0int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff40,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_C0int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -192
%6 = icmp ne i32 %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_C0int16_reg(i16 signext %0) {
%2 = and i16 %0, -192
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EPERM;
int /*<<< orphan*/ errno;
int write(int fd, const void *buf, unsigned int nbyte) {
  errno = EPERM;
  return -1;
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec2(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EPERM = global i32 0
@errno = global i32 0
define i32 @write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @EPERM
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EPERM = global i32 0
@errno = global i32 0
define i32 @write(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @EPERM
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ matrix_zero(int, int, int **);
int main(int argc, char *argv[]) {
  int m[][4] = {{1, 2, 3, 4}, {5, 0, 0, 8}, {9, 10, 11, 12}};
  matrix_zero(3, 4, m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdx
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <matrix_zero@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <matrix_zero@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.m = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 0, i32 0, i32 8], [4 x i32] [i32 9, i32 10, i32 11, i32 12]]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [3 x [4 x i32]]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = bitcast [3 x [4 x i32]]* %5 to i8*
%7 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %5, i64 0, i64 0
%8 = bitcast [4 x i32]* %7 to i32**
%9 = call i32 @matrix_zero(i32 3, i32 4, i32** %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.m = [3 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 5, i32 0, i32 0, i32 8], [4 x i32] [i32 9, i32 10, i32 11, i32 12]]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x [4 x i32]]
%4 = bitcast [3 x [4 x i32]]* %3 to i8*
%5 = bitcast [3 x [4 x i32]]* %3 to i32**
%6 = call i32 @matrix_zero(i32 3, i32 4, i32** %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void clean_array(char **to_clean) {
  for (int i = 0; i < 513; i++) {
    if (to_clean[i] != NULL) {
      free(to_clean[i]);
      to_clean[i] = NULL;
    } else {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<clean_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x201,-0xc(%rbp)
jge    1181 <clean_array+0x71>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1169 <clean_array+0x59>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    116e <clean_array+0x5e>
jmp    1181 <clean_array+0x71>
jmp    1173 <clean_array+0x63>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <clean_array+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_array>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
test   %rdi,%rdi
je     1143 <clean_array+0x33>
call   1030 <free@plt>
movq   $0x0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x201,%rbx
jne    1120 <clean_array+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @clean_array(i8** nocapture %0) {
br label %2
2: ; preds = %1, %7
%3 = phi i64 [ 0, %1 ], [ %9, %7 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = tail call i32 @free(i8* %5)
store i8* null, i8** %4
%9 = add nuw nsw i64 %3, 1
%10 = icmp eq i64 %9, 513
br i1 %10, label %11, label %2
11: ; preds = %2, %7
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void main() {
  FILE *fp = fopen("MyFile.txt", "w");
  fputs("Hello", fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebf(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"MyFile.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [6 x i8] c"Hello\00"
define void @main() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%5 = load i32*, i32** %1
%6 = call i32 @fclose(i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"MyFile.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [6 x i8] c"Hello\00"
define void @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 5, i64 1, i32* %1)
%3 = tail call i32 @fclose(i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "\nUsage:\n   %s\n\n",
          "envi2meta"
          " [-log <logfile>] <envi_name> <meta_name>\n"
          "             [-license] [-version] [-help]");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0xee5(%rip),%rdx
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
lea    0xee9(%rip),%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"\0AUsage:\0A %s\0A\0A\00"
@.str.1 = [94 x i8] c"envi2meta [-log <logfile>] <envi_name> <meta_name>\0A [-license] [-version] [-help]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"\0AUsage:\0A %s\0A\0A\00"
@.str.1 = [94 x i8] c"envi2meta [-log <logfile>] <envi_name> <meta_name>\0A [-license] [-version] [-help]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void f0(void) {
  switch (0) {
  case (unsigned long long)0 < 0:
    break;
  }
  switch (0) {
  case (unsigned long long)0 > 0:
    break;
  }
  switch (0) {
  case (unsigned long long)0 <= 0:
    break;
  }
  switch (0) {
  case (unsigned long long)0 >= 0:
    break;
  }
  switch (0) {
  case (unsigned long long)0 == 0:
    break;
  }
  switch (0) {
  case (unsigned long long)0 != 0:
    break;
  }
}


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

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

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

LLVM IR (-O2):
define void @f0() {
ret void
}
void g_io_channel_ref() {}


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

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

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

LLVM IR (-O2):
define void @g_io_channel_ref() {
ret void
}
int Add(int a, int b) {
  __asm__ __volatile__("addl %1,%0;\n" : "=m"(a) : "r"(b), "m"(a));
  return a;
}


x86 assembly (clang, -O0):
<Add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Add(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @Add(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
ret i32 %4
}
void writeSerial(char val) {
  volatile char *serial_base = (char *)0x20000000;
  char ready = 0;
  while (!ready) {
    ready = *(serial_base + 2);
  }
  *serial_base = val;
}


x86 assembly (clang, -O0):
<writeSerial>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x20000000,%eax
mov    %rax,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112d <writeSerial+0x2d>
jmp    113c <writeSerial+0x3c>
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x11(%rbp)
jmp    1117 <writeSerial+0x17>
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeSerial>:
cmpb   $0x0,0x20000002
je     1100 <writeSerial>
mov    %dil,0x20000000
20
ret

LLVM IR (-O0):
define void @writeSerial(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8
store i8 %0, i8* %2
store i8* inttoptr (i64 536870912 to i8*), i8** %3
store i8 0, i8* %4
br label %5
5: ; preds = %9, %1
%6 = load i8, i8* %4
%7 = icmp ne i8 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load volatile i8, i8* %11
store i8 %12, i8* %4
br label %5
13: ; preds = %5
%14 = load i8, i8* %2
%15 = load i8*, i8** %3
store volatile i8 %14, i8* %15
ret void
}

LLVM IR (-O2):
define void @writeSerial(i8 signext %0) {
br label %2
2: ; preds = %1, %2
%3 = load volatile i8, i8* inttoptr (i64 536870914 to i8*)
%4 = icmp eq i8 %3, 0
br i1 %4, label %2, label %5
5: ; preds = %2
store volatile i8 %0, i8* inttoptr (i64 536870912 to i8*)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ colormap_size;
};
typedef TYPE_1__ XVisualInfo;

/* Variables and functions */
int get_XVisualInfo_colormap_size(void *_p) {
  return (int)((XVisualInfo *)_p)->colormap_size;
}


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

x86 assembly (clang, -O2):
<get_XVisualInfo_colormap_size>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XVisualInfo_colormap_size(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XVisualInfo_colormap_size(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
int parse_config_file(struct options *o) {}


x86 assembly (clang, -O0):
<parse_config_file>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.options = type opaque
define i32 @parse_config_file(%struct.options* %0) {
%2 = alloca i32
%3 = alloca %struct.options*
store %struct.options* %0, %struct.options** %3
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
%struct.options = type opaque
define i32 @parse_config_file(%struct.options* nocapture readnone %0) {
ret i32 undef
}
int Fib(int index) {
  if (index <= 2)
    return 1;
  else
    return Fib(index - 1) + Fib(index - 2);
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ EFAULT;
int /*<<< orphan*/ errno;
extern int sigstack(struct sigstack *ss, struct sigstack *oss) {
  errno = EFAULT;
  return -1;
}


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

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

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

LLVM IR (-O2):
%struct.sigstack = type { i32 }
@EFAULT = global i32 0
@errno = global i32 0
define i32 @sigstack(%struct.sigstack* nocapture readnone %0, %struct.sigstack* nocapture readnone %1) {
%3 = load i32, i32* @EFAULT
store i32 %3, i32* @errno
ret i32 -1
}
int rk31sdk_get_sdio_wifi_voltage(void) {
  int voltage;
  voltage = 3000;
  printk("%s:sdio-wifi-voltage=%d\n", __func__, voltage);
  return voltage;
}


x86 assembly (clang, -O0):
<rk31sdk_get_sdio_wifi_voltage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xbb8,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xed7(%rip),%rdi
lea    0xee9(%rip),%rsi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rk31sdk_get_sdio_wifi_voltage>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xefa(%rip),%rsi
mov    $0xbb8,%edx
xor    %eax,%eax
call   1030 <printk@plt>
mov    $0xbb8,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%s:sdio-wifi-voltage=%d\0A\00"
@__func__.rk31sdk_get_sdio_wifi_voltage = [30 x i8] c"rk31sdk_get_sdio_wifi_voltage\00"
define i32 @rk31sdk_get_sdio_wifi_voltage() {
%1 = alloca i32
store i32 3000, i32* %1
%2 = load i32, i32* %1
%3 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @__func__.rk31sdk_get_sdio_wifi_voltage, i64 0, i64 0), i32 %2)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s:sdio-wifi-voltage=%d\0A\00"
@__func__.rk31sdk_get_sdio_wifi_voltage = [30 x i8] c"rk31sdk_get_sdio_wifi_voltage\00"
define i32 @rk31sdk_get_sdio_wifi_voltage() {
%1 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @__func__.rk31sdk_get_sdio_wifi_voltage, i64 0, i64 0), i32 3000)
ret i32 3000
}
void genmfc1() {}


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

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

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

LLVM IR (-O2):
define void @genmfc1() {
ret void
}
/* Type definitions */
struct list_elem {
  int dummy;
};
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ list_isempty(struct list *);
struct list_elem *list_remove(struct list_elem *);
struct list_elem *list_tail(struct list *);
struct list_elem *list_popback(struct list *l) {
  struct list_elem *e;
  assert(l != NULL);
  assert(!list_isempty(l));
  e = list_tail(l);
  return list_remove(e);
}


x86 assembly (clang, -O0):
<list_popback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <list_isempty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <list_tail@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <list_remove@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_popback>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <list_isempty@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <list_tail@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1060 <list_remove@plt>

LLVM IR (-O0):
%struct.list_elem = type { i32 }
%struct.list = type { i32 }
define %struct.list_elem* @list_popback(%struct.list* %0) {
%2 = alloca %struct.list*
%3 = alloca %struct.list_elem*
store %struct.list* %0, %struct.list** %2
%4 = load %struct.list*, %struct.list** %2
%5 = icmp ne %struct.list* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load %struct.list*, %struct.list** %2
%9 = call i32 @list_isempty(%struct.list* %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load %struct.list*, %struct.list** %2
%15 = call %struct.list_elem* @list_tail(%struct.list* %14)
store %struct.list_elem* %15, %struct.list_elem** %3
%16 = load %struct.list_elem*, %struct.list_elem** %3
%17 = call %struct.list_elem* @list_remove(%struct.list_elem* %16)
ret %struct.list_elem* %17
}

LLVM IR (-O2):
%struct.list_elem = type { i32 }
%struct.list = type { i32 }
define %struct.list_elem* @list_popback(%struct.list* %0) {
%2 = icmp ne %struct.list* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @list_isempty(%struct.list* %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call %struct.list_elem* @list_tail(%struct.list* %0)
%10 = tail call %struct.list_elem* @list_remove(%struct.list_elem* %9)
ret %struct.list_elem* %10
}
unsigned short b_us(unsigned short a, unsigned char *b, int *c) {
  unsigned short d = a - *b;
  *c = d == 0;
  return d;
}


x86 assembly (clang, -O0):
<b_us>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
mov    %ax,-0x1a(%rbp)
movzwl -0x1a(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movzwl -0x1a(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_us>:
mov    %edi,%eax
movzbl (%rsi),%ecx
xor    %esi,%esi
sub    %cx,%ax
sete   %sil
mov    %esi,(%rdx)
ret

LLVM IR (-O0):
define zeroext i16 @b_us(i16 zeroext %0, i8* %1, i32* %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i16
store i16 %0, i16* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = sub nsw i32 %9, %12
%14 = trunc i32 %13 to i16
store i16 %14, i16* %7
%15 = load i16, i16* %7
%16 = zext i16 %15 to i32
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i16, i16* %7
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @b_us(i16 zeroext %0, i8* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i8, i8* %1
%5 = zext i8 %4 to i16
%6 = sub i16 %0, %5
%7 = icmp eq i16 %6, 0
%8 = zext i1 %7 to i32
store i32 %8, i32* %2
ret i16 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char colour;
  scanf(" %c", &colour);
  printf("I am B. I play %c. \n", colour);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebe(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %c\00"
@.str.1 = [21 x i8] c"I am B. I play %c. \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" %c\00"
@.str.1 = [21 x i8] c"I am B. I play %c. \0A\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8 signext %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usbFatalError();
void ep2TransmitCallback(void) { usbFatalError(); }


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

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

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

LLVM IR (-O2):
define void @ep2TransmitCallback() {
%1 = tail call i32 (...) @usbFatalError()
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int func(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char **argv) {
  int val = 4;
  int fv = func(val);
  printf("f(%d) = %d\n", val, fv);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <func@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <func@plt>
lea    0xece(%rip),%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"f(%d) = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @func(i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 4, i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
int zero() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @zero() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("The First Soloist\n\n\n\n");
  printf("Vocalist Mary McDiva\n");
  return (0);
}


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

LLVM IR (-O0):
@.str = [22 x i8] c"The First Soloist\0A\0A\0A\0A\00"
@.str.1 = [22 x i8] c"Vocalist Mary McDiva\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"The First Soloist\0A\0A\0A\00"
@str.2 = [21 x i8] c"Vocalist Mary McDiva\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
double vde_chain_nm6_sq(double x) { return x * x; }


x86 assembly (clang, -O0):
<vde_chain_nm6_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<vde_chain_nm6_sq>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @vde_chain_nm6_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
void av_opt_get() {}


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

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

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

LLVM IR (-O2):
define void @av_opt_get() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_args(int, char **);
int /*<<< orphan*/ print_results();
int /*<<< orphan*/ process_data();
int main(int argc, char **argv) {
  get_args(argc, argv);
  process_data();
  print_results();
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1050 <get_args@plt>
xor    %eax,%eax
call   1030 <process_data@plt>
xor    %eax,%eax
call   1040 <print_results@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = load i8**, i8*** %4
%7 = call i32 @get_args(i32 %5, i8** %6)
%8 = call i32 (...) @process_data()
%9 = call i32 (...) @print_results()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @get_args(i32 %0, i8** %1)
%4 = tail call i32 (...) @process_data()
%5 = tail call i32 (...) @print_results()
ret i32 0
}
/* Variables and functions */
short *vrna_ptable(char const *);
short *make_pair_table(const char *structure) { return vrna_ptable(structure); }


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

x86 assembly (clang, -O2):
<make_pair_table>:
jmp    1030 <vrna_ptable@plt>

LLVM IR (-O0):
define i16* @make_pair_table(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i16* @vrna_ptable(i8* %3)
ret i16* %4
}

LLVM IR (-O2):
define i16* @make_pair_table(i8* %0) {
%2 = tail call i16* @vrna_ptable(i8* %0)
ret i16* %2
}
/* Type definitions */
struct nlattr {
  int nla_type;
};

/* Variables and functions */
void *nla_data(struct nlattr *);
struct nlattr *nla_nested_start(void **ctx, int t) {
  struct nlattr *nla = (struct nlattr *)*ctx;
  nla->nla_type = t;
  *ctx = nla_data(nla);
  return nla;
}


x86 assembly (clang, -O0):
<nla_nested_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
call   1030 <nla_data@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nla_nested_start>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
mov    %esi,(%rbx)
mov    %rbx,%rdi
call   1030 <nla_data@plt>
mov    %rax,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.nlattr = type { i32 }
define %struct.nlattr* @nla_nested_start(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca %struct.nlattr*
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = bitcast i8* %7 to %struct.nlattr*
store %struct.nlattr* %8, %struct.nlattr** %5
%9 = load i32, i32* %4
%10 = load %struct.nlattr*, %struct.nlattr** %5
%11 = getelementptr inbounds %struct.nlattr, %struct.nlattr* %10, i32 0, i32 0
store i32 %9, i32* %11
%12 = load %struct.nlattr*, %struct.nlattr** %5
%13 = call i8* @nla_data(%struct.nlattr* %12)
%14 = load i8**, i8*** %3
store i8* %13, i8** %14
%15 = load %struct.nlattr*, %struct.nlattr** %5
ret %struct.nlattr* %15
}

LLVM IR (-O2):
%struct.nlattr = type { i32 }
define %struct.nlattr* @nla_nested_start(i8** nocapture %0, i32 %1) {
%3 = bitcast i8** %0 to %struct.nlattr**
%4 = load %struct.nlattr*, %struct.nlattr** %3
%5 = getelementptr inbounds %struct.nlattr, %struct.nlattr* %4, i64 0, i32 0
store i32 %1, i32* %5
%6 = tail call i8* @nla_data(%struct.nlattr* %4)
store i8* %6, i8** %0
ret %struct.nlattr* %4
}
void handle_QUIT(sig) int sig;
{}


x86 assembly (clang, -O0):
<handle_QUIT>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @handle_QUIT(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @handle_QUIT(i32 %0) {
ret void
}
/* Type definitions */
struct opaque_auth {
  int dummy;
};
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ AUTH;

/* Variables and functions */
int /*<<< orphan*/ TRUE;
bool_t authnone_validate(AUTH *x, struct opaque_auth *x1) { return (TRUE); }


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

x86 assembly (clang, -O2):
<authnone_validate>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.opaque_auth = type { i32 }
@TRUE = global i32 0
define i32 @authnone_validate(i32* %0, %struct.opaque_auth* %1) {
%3 = alloca i32*
%4 = alloca %struct.opaque_auth*
store i32* %0, i32** %3
store %struct.opaque_auth* %1, %struct.opaque_auth** %4
%5 = load i32, i32* @TRUE
ret i32 %5
}

LLVM IR (-O2):
%struct.opaque_auth = type { i32 }
@TRUE = global i32 0
define i32 @authnone_validate(i32* nocapture readnone %0, %struct.opaque_auth* nocapture readnone %1) {
%3 = load i32, i32* @TRUE
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print(int *data, int length) {
  int i;
  for (i = 0; i < length; i++) {
    printf(" %d", data[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
define void @print(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
int get_array_length(char line[]) { return sizeof(line) / sizeof(char); }


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

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

LLVM IR (-O0):
define i32 @get_array_length(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i32 8
}

LLVM IR (-O2):
define i32 @get_array_length(i8* nocapture readnone %0) {
ret i32 8
}
/* Type definitions */
typedef int /*<<< orphan*/ int_fast8_t;

/* Variables and functions */
void SHAREMIND_MAP_KEY_FREE_int_fast8_t(int_fast8_t *const dest) { (void)dest; }


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

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

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

LLVM IR (-O2):
define void @SHAREMIND_MAP_KEY_FREE_int_fast8_t(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char const *);
void eleven(const char *str) {
  char s[12] = "Hello ";
  strcat(s, str);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<eleven>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcat@plt>
lea    -0x14(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eleven>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
movabs $0x206f6c6c6548,%rax
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.eleven.s = [12 x i8] c"Hello \00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define void @eleven(i8* %0) {
%2 = alloca i8*
%3 = alloca [12 x i8]
store i8* %0, i8** %2
%4 = bitcast [12 x i8]* %3 to i8*
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @strcat(i8* %5, i8* %6)
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@__const.eleven.s = [12 x i8] c"Hello \00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
define void @eleven(i8* %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcat(i8* %3, i8* %0)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
void audio_music_start(int num) {}


x86 assembly (clang, -O0):
<audio_music_start>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @audio_music_start(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @audio_music_start(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void sjekk_sann(int testbool, const char *testnavn) {
  if (testbool)
    printf("%s:\tpass\n", testnavn);
  else
    printf("%s:\tfeil\n", testnavn);
}


x86 assembly (clang, -O0):
<sjekk_sann>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113e <sjekk_sann+0x2e>
mov    -0x10(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    114e <sjekk_sann+0x3e>
mov    -0x10(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sjekk_sann>:
test   %edi,%edi
lea    0xef1(%rip),%rax
lea    0xee0(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%s:\09pass\0A\00"
@.str.1 = [10 x i8] c"%s:\09feil\0A\00"
define void @sjekk_sann(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %13
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s:\09pass\0A\00"
@.str.1 = [10 x i8] c"%s:\09feil\0A\00"
define void @sjekk_sann(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i8* %1)
ret void
}