xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ M_DrawCharacter(int, int, char);
void M_PrintWhite(int cx, int cy, char *str) {
  while (*str) {
    M_DrawCharacter(cx, cy, *str);
    str++;
    cx += 8;
  }
}


x86 assembly (clang, -O0):
<M_PrintWhite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <M_PrintWhite+0x4b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
call   1030 <M_DrawCharacter@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    1122 <M_PrintWhite+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_PrintWhite>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdx),%al
test   %al,%al
je     114b <M_PrintWhite+0x3b>
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <M_DrawCharacter@plt>
add    $0x8,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <M_PrintWhite+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @M_PrintWhite(i32 %0, i32 %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %13, %6 ], [ %4, %3 ]
%8 = phi i8* [ %11, %6 ], [ %2, %3 ]
%9 = phi i32 [ %12, %6 ], [ %0, %3 ]
%10 = tail call i32 @M_DrawCharacter(i32 %9, i32 %1, i8 signext %7)
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = add nsw i32 %9, 8
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %3
ret void
}
unsigned char inb(unsigned int port) {
  unsigned char ret;
  asm volatile("inb %%dx,%%al" : "=a"(ret) : "d"(port));
  return ret;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8 asm sideeffect "inb %dx,%al", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i32 %0) {
%2 = tail call i8 asm sideeffect "inb %dx,%al", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i8 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
void st_i8_be(void *x, int8_t i) { ((int8_t *)x)[0] = i; }


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

x86 assembly (clang, -O2):
<st_i8_be>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @st_i8_be(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @st_i8_be(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int findKey(char *);
int findend(int);
int getValue(char *key) {
  int kaddr = findKey(key);
  return (kaddr < 0) ? kaddr : findend(kaddr);
}


x86 assembly (clang, -O0):
<getValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <findKey@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114d <getValue+0x2d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1158 <getValue+0x38>
mov    -0xc(%rbp),%edi
call   1040 <findend@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getValue>:
push   %rax
call   1030 <findKey@plt>
test   %eax,%eax
js     1132 <getValue+0x12>
mov    %eax,%edi
pop    %rax
jmp    1040 <findend@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @getValue(i8* %0) {
%2 = tail call i32 @findKey(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @findend(i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Type definitions */
struct _reent {
  int dummy;
};

/* Variables and functions */
void free(void *);
void _free_r(struct _reent *r, void *ptr) { return free(ptr); }


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

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

LLVM IR (-O0):
%struct._reent = type { i32 }
define void @_free_r(%struct._reent* %0, i8* %1) {
%3 = alloca %struct._reent*
%4 = alloca i8*
store %struct._reent* %0, %struct._reent** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
%struct._reent = type { i32 }
define void @_free_r(%struct._reent* nocapture readnone %0, i8* nocapture %1) {
tail call void @free(i8* %1)
ret void
}
void arria10_prepare_mmc(int barebox, int bitstream) { return; }


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

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

LLVM IR (-O0):
define void @arria10_prepare_mmc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @arria10_prepare_mmc(i32 %0, i32 %1) {
ret void
}
void Uart_Init() {
  (*((volatile unsigned long *)0xE0200000)) = 0x22222222;
  (*((volatile unsigned long *)0xE0200020)) = 0x2222;
  (*((volatile unsigned long *)0xE2900008)) = 0x1;
  (*((volatile unsigned long *)0xE290000C)) = 0x0;
  (*((volatile unsigned long *)0xE2900000)) = 0x3;
  (*((volatile unsigned long *)0xE2900004)) = 0x5;
  (*((volatile unsigned long *)0xE2900028)) = 35;
  (*((volatile unsigned long *)0xE290002C)) = 0x1;
}


x86 assembly (clang, -O0):
<Uart_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0200000,%eax
movq   $0x22222222,(%rax)
mov    $0xe0200020,%eax
movq   $0x2222,(%rax)
mov    $0xe2900008,%eax
movq   $0x1,(%rax)
mov    $0xe290000c,%eax
movq   $0x0,(%rax)
mov    $0xe2900000,%eax
movq   $0x3,(%rax)
mov    $0xe2900004,%eax
movq   $0x5,(%rax)
mov    $0xe2900028,%eax
movq   $0x23,(%rax)
mov    $0xe290002c,%eax
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Uart_Init>:
mov    $0xe0200000,%eax
movq   $0x22222222,(%rax)
movq   $0x2222,0x20(%rax)
movq   $0x1,0x2700008(%rax)
movq   $0x0,0x270000c(%rax)
movq   $0x3,0x2700000(%rax)
movq   $0x5,0x2700004(%rax)
movq   $0x23,0x2700028(%rax)
movq   $0x1,0x270002c(%rax)
ret

LLVM IR (-O0):
define void @Uart_Init() {
store volatile i64 572662306, i64* inttoptr (i64 3760193536 to i64*)
store volatile i64 8738, i64* inttoptr (i64 3760193568 to i64*)
store volatile i64 1, i64* inttoptr (i64 3801088008 to i64*)
store volatile i64 0, i64* inttoptr (i64 3801088012 to i64*)
store volatile i64 3, i64* inttoptr (i64 3801088000 to i64*)
store volatile i64 5, i64* inttoptr (i64 3801088004 to i64*)
store volatile i64 35, i64* inttoptr (i64 3801088040 to i64*)
store volatile i64 1, i64* inttoptr (i64 3801088044 to i64*)
ret void
}

LLVM IR (-O2):
define void @Uart_Init() {
store volatile i64 572662306, i64* inttoptr (i64 3760193536 to i64*)
store volatile i64 8738, i64* inttoptr (i64 3760193568 to i64*)
store volatile i64 1, i64* inttoptr (i64 3801088008 to i64*)
store volatile i64 0, i64* inttoptr (i64 3801088012 to i64*)
store volatile i64 3, i64* inttoptr (i64 3801088000 to i64*)
store volatile i64 5, i64* inttoptr (i64 3801088004 to i64*)
store volatile i64 35, i64* inttoptr (i64 3801088040 to i64*)
store volatile i64 1, i64* inttoptr (i64 3801088044 to i64*)
ret void
}
int do_266() { return 266; }


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

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

LLVM IR (-O0):
define i32 @do_266() {
ret i32 266
}

LLVM IR (-O2):
define i32 @do_266() {
ret i32 266
}
void symbol41_i386_and_optional(void) {}


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

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

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

LLVM IR (-O2):
define void @symbol41_i386_and_optional() {
ret void
}
unsigned int mg_bsd_get_unused_bits_num(void) { return (8); }


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

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

LLVM IR (-O0):
define i32 @mg_bsd_get_unused_bits_num() {
ret i32 8
}

LLVM IR (-O2):
define i32 @mg_bsd_get_unused_bits_num() {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ sleep(unsigned int);
void MySleep(unsigned seconds) { sleep(seconds); }


x86 assembly (clang, -O0):
<MySleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MySleep>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @MySleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret void
}
char *get_file_mode_r(char binary_on) { return binary_on ? "rb" : "r"; }


x86 assembly (clang, -O0):
<get_file_mode_r>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
lea    0xeee(%rip),%rax
lea    0xee4(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_mode_r>:
test   %dil,%dil
lea    0xef9(%rip),%rcx
lea    0xeef(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [2 x i8] c"r\00"
define i8* @get_file_mode_r(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
ret i8* %7
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [2 x i8] c"r\00"
define i8* @get_file_mode_r(i8 signext %0) {
%2 = icmp eq i8 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void info() { fprintf(stdout, "Try \'uiextract -h\' for more information\n"); }


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [41 x i8] c"Try 'uiextract -h' for more information\0A\00"
define void @info() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [41 x i8] c"Try 'uiextract -h' for more information\0A\00"
define void @info() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ permute(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char str[10];
  scanf("%s", str);
  int n = strlen(str);
  permute(str, 0, n - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xe(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
lea    -0xe(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @strlen(i8* %2)
%5 = add nsw i32 %4, -1
%6 = call i32 @permute(i8* %2, i32 0, i32 %5)
ret i32 0
}
void ScaleARGBRowDown2Box_NEON() {}


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

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

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

LLVM IR (-O2):
define void @ScaleARGBRowDown2Box_NEON() {
ret void
}
/* Variables and functions */
int rand();
int irandom(int min, int max) {
  max++;
  return (((rand() & 0x7FFF) * (max - min)) >> 15) + min;
}


x86 assembly (clang, -O0):
<irandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0x7fff,%eax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
imul   %ecx,%eax
sar    $0xf,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irandom>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x7fff,%eax
sub    %ebp,%ebx
add    $0x1,%ebx
imul   %ebx,%eax
sar    $0xf,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @irandom(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 = add nsw i32 %5, 1
store i32 %6, i32* %4
%7 = call i32 (...) @rand()
%8 = and i32 %7, 32767
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = mul nsw i32 %8, %11
%13 = ashr i32 %12, 15
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @irandom(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = and i32 %3, 32767
%5 = sub i32 1, %0
%6 = add i32 %5, %1
%7 = mul nsw i32 %4, %6
%8 = ashr i32 %7, 15
%9 = add nsw i32 %8, %0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void wakeup(int signum) { printf("Alarm received from kernel\n"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"Alarm received from kernel\0A\00"
define void @wakeup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"Alarm received from kernel\00"
define void @wakeup(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ calc_tree(struct tree *);
double cos(int /*<<< orphan*/);
double fun_cos(struct tree *tree) { return cos(calc_tree(tree)); }


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

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

LLVM IR (-O0):
%struct.tree = type { i32 }
define double @fun_cos(%struct.tree* %0) {
%2 = alloca %struct.tree*
store %struct.tree* %0, %struct.tree** %2
%3 = load %struct.tree*, %struct.tree** %2
%4 = call i32 @calc_tree(%struct.tree* %3)
%5 = call double @cos(i32 %4)
ret double %5
}

LLVM IR (-O2):
%struct.tree = type { i32 }
define double @fun_cos(%struct.tree* %0) {
%2 = tail call i32 @calc_tree(%struct.tree* %0)
%3 = tail call double @cos(i32 %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ inb(int);
int /*<<< orphan*/ outb(int /*<<< orphan*/, int);
void smbus_delay(void) { outb(inb(0x80), 0x80); }


x86 assembly (clang, -O0):
<smbus_delay>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80,%edi
call   1040 <inb@plt>
mov    %eax,%edi
mov    $0x80,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbus_delay>:
push   %rax
mov    $0x80,%edi
call   1040 <inb@plt>
mov    %eax,%edi
mov    $0x80,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @smbus_delay() {
%1 = call i32 @inb(i32 128)
%2 = call i32 @outb(i32 %1, i32 128)
ret void
}

LLVM IR (-O2):
define void @smbus_delay() {
%1 = tail call i32 @inb(i32 128)
%2 = tail call i32 @outb(i32 %1, i32 128)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_CRL;
typedef int /*<<< orphan*/ ASN1_TIME;

/* Variables and functions */
int X509_CRL_set_nextUpdate(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm) {
  return X509_CRL_set_nextUpdate(x, tm);
}


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

x86 assembly (clang, -O2):
<X509_CRL_set1_nextUpdate>:
jmp    1030 <X509_CRL_set_nextUpdate@plt>

LLVM IR (-O0):
define i32 @X509_CRL_set1_nextUpdate(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 @X509_CRL_set_nextUpdate(i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @X509_CRL_set1_nextUpdate(i32* %0, i32* %1) {
%3 = tail call i32 @X509_CRL_set_nextUpdate(i32* %0, i32* %1)
ret i32 %3
}
/* Type definitions */
typedef int u_int64_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
u_int64_t kore_time_ms(void) {
  struct timeval tv;
  if (gettimeofday(&tv, NULL) == -1)
    return (0);
  return (tv.tv_sec * 1000 + (tv.tv_usec / 1000));
}


x86 assembly (clang, -O0):
<kore_time_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    113a <kore_time_ms+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1159 <kore_time_ms+0x49>
imul   $0x3e8,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kore_time_ms>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
je     114b <kore_time_ms+0x3b>
imul   $0x3e8,0x8(%rsp),%eax
movslq 0xc(%rsp),%rcx
imul   $0x10624dd3,%rcx,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rbx
add    %ecx,%ebx
add    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @kore_time_ms() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %14
6: ; preds = %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %9, %12
store i32 %13, i32* %1
br label %14
14: ; preds = %6, %5
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @kore_time_ms() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %13, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %11, %8
br label %13
13: ; preds = %0, %5
%14 = phi i32 [ %12, %5 ], [ 0, %0 ]
ret i32 %14
}
void floatFunc(float x) { return; }


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

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

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

LLVM IR (-O2):
define void @floatFunc(float %0) {
ret void
}
void sched_rt_handler(void) { nsc_assert(0, __func__); }


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

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

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

LLVM IR (-O2):
@__func__.sched_rt_handler = [17 x i8] c"sched_rt_handler\00"
define void @sched_rt_handler() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.sched_rt_handler, i64 0, i64 0))
ret void
}
unsigned short le16toh(unsigned short val) {
  return (val & 0xff) << 8 | (val & 0xff00) >> 8;
}


x86 assembly (clang, -O0):
<le16toh>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
movzwl -0x2(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<le16toh>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @le16toh(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 255
%6 = shl i32 %5, 8
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = and i32 %8, 65280
%10 = ashr i32 %9, 8
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @le16toh(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
const char *selectOpName(int id) {
  char *z;
  switch (id) {
  case 104:
    z = "UNION ALL";
    break;
  case 105:
    z = "INTERSECT";
    break;
  case 106:
    z = "EXCEPT";
    break;
  default:
    z = "UNION";
    break;
  }
  return z;
}


x86 assembly (clang, -O0):
<selectOpName>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x68,%eax
je     113d <selectOpName+0x3d>
jmp    111b <selectOpName+0x1b>
mov    -0x14(%rbp),%eax
sub    $0x69,%eax
je     114d <selectOpName+0x4d>
jmp    112c <selectOpName+0x2c>
mov    -0x14(%rbp),%eax
sub    $0x6a,%eax
je     115d <selectOpName+0x5d>
jmp    116d <selectOpName+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <selectOpName+0x78>
lea    0xeb6(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <selectOpName+0x78>
lea    0xeb0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <selectOpName+0x78>
lea    0xea7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<selectOpName>:
add    $0xffffff98,%edi
cmp    $0x2,%edi
ja     111a <selectOpName+0x1a>
movslq %edi,%rax
lea    0xf12(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xefa(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"UNION ALL\00"
@.str.1 = [10 x i8] c"INTERSECT\00"
@.str.2 = [7 x i8] c"EXCEPT\00"
@.str.3 = [6 x i8] c"UNION\00"
define i8* @selectOpName(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 104, label %5
i32 105, label %6
i32 106, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %3
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [10 x i8] c"UNION ALL\00"
@.str.1 = [10 x i8] c"INTERSECT\00"
@.str.2 = [7 x i8] c"EXCEPT\00"
@.str.3 = [6 x i8] c"UNION\00"
@reltable.selectOpName = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.selectOpName to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.selectOpName to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.selectOpName to i64)) to i32)]
define i8* @selectOpName(i32 %0) {
%2 = add i32 %0, -104
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.selectOpName to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %1 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ dump_raw_message(char, int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void handle_uplink_frame(uint64_t timestamp, uint8_t *frame, int rs) {
  dump_raw_message('+', frame, (((6) * (576)) / 8), rs);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<handle_uplink_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    $0x2b,%edi
mov    $0x1b0,%edx
call   1030 <dump_raw_message@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_uplink_frame>:
push   %rax
mov    %edx,%ecx
mov    $0x2b,%edi
mov    $0x1b0,%edx
call   1030 <dump_raw_message@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @handle_uplink_frame(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %5
%8 = load i32, i32* %6
%9 = call i32 @dump_raw_message(i8 signext 43, i32* %7, i32 432, i32 %8)
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @handle_uplink_frame(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @dump_raw_message(i8 signext 43, i32* %1, i32 432, i32 %2)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XParseGeometry() {
  printf("XParseGeometry called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [22 x i8] c"XParseGeometry called\00"
define i32 @XParseGeometry() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *get_talpa_device(char *, char *);
char *get_talpa_vcdevice(void) {
  return get_talpa_device(
      "talpa-vc", "/filter-interfaces/DeviceDriverVettingClient/device");
}


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

x86 assembly (clang, -O2):
<get_talpa_vcdevice>:
lea    0xee9(%rip),%rdi
lea    0xeeb(%rip),%rsi
jmp    1030 <get_talpa_device@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"talpa-vc\00"
@.str.1 = [52 x i8] c"/filter-interfaces/DeviceDriverVettingClient/device\00"
define i8* @get_talpa_vcdevice() {
%1 = call i8* @get_talpa_device(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [9 x i8] c"talpa-vc\00"
@.str.1 = [52 x i8] c"/filter-interfaces/DeviceDriverVettingClient/device\00"
define i8* @get_talpa_vcdevice() {
%1 = tail call i8* @get_talpa_device(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
ret i8* %1
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
void bs_copy(unsigned char *dest, int32_t dest_off, unsigned char *source,
             int32_t source_off, int32_t length) {
  memcpy(dest + dest_off, source + source_off, length);
}


x86 assembly (clang, -O0):
<bs_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @bs_copy(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %2, i64 %8
%10 = tail call i32 @memcpy(i8* %7, i8* %9, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MyTestFunction();
int main(int argc, char **argv) { MyTestFunction(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <MyTestFunction@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 = call i32 (...) @MyTestFunction()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @MyTestFunction()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ diag_dump_buf_with_offset(int /*<<< orphan*/ *,
                                             int /*<<< orphan*/,
                                             int /*<<< orphan*/);
void diag_dump_buf(void *p, uint32_t s) {
  diag_dump_buf_with_offset((uint8_t *)p, s, 0);
}


x86 assembly (clang, -O0):
<diag_dump_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1030 <diag_dump_buf_with_offset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diag_dump_buf>:
xor    %edx,%edx
jmp    1030 <diag_dump_buf_with_offset@plt>

LLVM IR (-O0):
define void @diag_dump_buf(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 @diag_dump_buf_with_offset(i32* %6, i32 %7, i32 0)
ret void
}

LLVM IR (-O2):
define void @diag_dump_buf(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @diag_dump_buf_with_offset(i32* %3, i32 %1, i32 0)
ret void
}
/* Variables and functions */
char *os_str_trim_left(int /*<<< orphan*/);
int /*<<< orphan*/ os_str_trim_right(char *);
char *os_str_trim(char *str) {
  return os_str_trim_left(os_str_trim_right(str));
}


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

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

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

LLVM IR (-O2):
define i8* @os_str_trim(i8* %0) {
%2 = tail call i32 @os_str_trim_right(i8* %0)
%3 = tail call i8* @os_str_trim_left(i32 %2)
ret i8* %3
}
int main() {
  int var = 20;
  int *ip;
  ip = &var;
  printf("Address of var variable: %x\n", &var);
  printf("Address stored in ip variable: %x\n", ip);
  printf("Value of *ip variable: %d\n", *ip);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x14,0xc(%rsp)
lea    0xedc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xef1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Address of var variable: %x\0A\00"
@.str.1 = [35 x i8] c"Address stored in ip variable: %x\0A\00"
@.str.2 = [27 x i8] c"Value of *ip variable: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 20, i32* %2
store i32* %2, i32** %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32*, i32** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Address of var variable: %x\0A\00"
@.str.1 = [35 x i8] c"Address stored in ip variable: %x\0A\00"
@.str.2 = [27 x i8] c"Value of *ip variable: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 20, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}
unsigned int vied_byte_slice(unsigned int value, unsigned int byte0,
                             unsigned int numbytes) {
  unsigned int mask = (1 << (numbytes * 8)) - 1;
  return (value >> (byte0 * 8)) & mask;
}


x86 assembly (clang, -O0):
<vied_byte_slice>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
shr    %cl,%eax
and    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vied_byte_slice>:
lea    0x0(,%rdx,8),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
lea    0x0(,%rsi,8),%ecx
shr    %cl,%edi
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @vied_byte_slice(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = mul i32 %8, 8
%10 = shl i32 1, %9
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = mul i32 %13, 8
%15 = lshr i32 %12, %14
%16 = load i32, i32* %7
%17 = and i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @vied_byte_slice(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 3
%5 = shl nsw i32 -1, %4
%6 = xor i32 %5, -1
%7 = shl i32 %1, 3
%8 = lshr i32 %0, %7
%9 = and i32 %8, %6
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ csr_exit(int, char *);
int /*<<< orphan*/ perror(char const *);
void csr_perror(const char *s) {
  csr_exit(-1, "");
  perror(s);
}


x86 assembly (clang, -O0):
<csr_perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffff,%edi
lea    0xec8(%rip),%rsi
call   1030 <csr_exit@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csr_perror>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
mov    $0xffffffff,%edi
call   1030 <csr_exit@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @csr_perror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @csr_exit(i32 -1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @perror(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @csr_perror(i8* nocapture %0) {
%2 = tail call i32 @csr_exit(i32 -1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @perror(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int *, int);
void copy_ivec(int n, int *dest, int *p) { memcpy(dest, p, n * sizeof(int)); }


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

x86 assembly (clang, -O2):
<copy_ivec>:
lea    0x0(,%rdi,4),%eax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %eax,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @copy_ivec(i32 %0, i32* %1, i32* %2) {
%4 = shl i32 %0, 2
%5 = tail call i32 @memcpy(i32* %1, i32* %2, i32 %4)
ret void
}
/* Type definitions */
typedef union sigval {
  int dummy;
} sigval;

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void notify_func1(union sigval sigval) { puts("notify_func1"); }


x86 assembly (clang, -O0):
<notify_func1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.sigval = type { i32 }
@.str = [13 x i8] c"notify_func1\00"
define void @notify_func1(i32 %0) {
%2 = alloca %union.sigval
%3 = getelementptr inbounds %union.sigval, %union.sigval* %2, i32 0, i32 0
store i32 %0, i32* %3
%4 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"notify_func1\00"
define void @notify_func1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int pthread_mutex_init(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int);
int /*<<< orphan*/ tq_set_error(char *, int /*<<< orphan*/);
int tq_mutex_init(pthread_mutex_t *mutex) {
  int err;
  err = pthread_mutex_init(mutex, NULL);
  if (err) {
    tq_set_error("cannot create mutex: %s", strerror(err));
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<tq_mutex_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pthread_mutex_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1178 <tq_mutex_init+0x48>
mov    -0x14(%rbp),%edi
call   1040 <strerror@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1030 <tq_set_error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117f <tq_mutex_init+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tq_mutex_init>:
push   %rbx
xor    %ebx,%ebx
xor    %esi,%esi
call   1050 <pthread_mutex_init@plt>
test   %eax,%eax
je     1158 <tq_mutex_init+0x28>
mov    %eax,%edi
call   1040 <strerror@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
call   1030 <tq_set_error@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"cannot create mutex: %s\00"
define i32 @tq_mutex_init(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @pthread_mutex_init(i32* %5, i32* null)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* %4
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @tq_set_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 -1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [24 x i8] c"cannot create mutex: %s\00"
define i32 @tq_mutex_init(i32* %0) {
%2 = tail call i32 @pthread_mutex_init(i32* %0, i32* null)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @strerror(i32 %2)
%6 = tail call i32 @tq_set_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %8
}