xunge/DecIR huggingface dataset:
unsigned long strtoul(const char *nptr, char **endptr, int base) { return 4; }


x86 assembly (clang, -O0):
<strtoul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x4,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @strtoul(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
ret i64 4
}

LLVM IR (-O2):
define i64 @strtoul(i8* nocapture readnone %0, i8** nocapture readnone %1, i32 %2) {
ret i64 4
}
/* Variables and functions */
int /*<<< orphan*/ mlock(char *, int);
int /*<<< orphan*/ munlock(char *, int);
int main(void) {
  char x[16];
  mlock(x, sizeof x);
  munlock(x, sizeof x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1040 <mlock@plt>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1030 <munlock@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <mlock@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1030 <munlock@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @mlock(i8* %3, i32 16)
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%6 = call i32 @munlock(i8* %5, i32 16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @mlock(i8* %2, i32 16)
%4 = call i32 @munlock(i8* %2, i32 16)
ret i32 0
}
/* Variables and functions */
char *eat_space_end(char *, char *);
int is_empty_end(char *p, char *pend) {
  p = eat_space_end(p, pend);
  return ((p < (pend)) && (*p == '\r' || *p == '\n'));
}


x86 assembly (clang, -O0):
<is_empty_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <eat_space_end@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
jae    116f <is_empty_end+0x5f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x12(%rbp)
je     1169 <is_empty_end+0x59>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_empty_end>:
push   %rbx
mov    %rsi,%rbx
call   1030 <eat_space_end@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
jae    1137 <is_empty_end+0x27>
mov    (%rcx),%cl
mov    $0x1,%eax
cmp    $0xd,%cl
je     1137 <is_empty_end+0x27>
xor    %eax,%eax
cmp    $0xa,%cl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_empty_end(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @eat_space_end(i8* %5, i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = icmp ult i8* %8, %9
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 13
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 10
br label %21
21: ; preds = %16, %11
%22 = phi i1 [ true, %11 ], [ %20, %16 ]
br label %23
23: ; preds = %21, %2
%24 = phi i1 [ false, %2 ], [ %22, %21 ]
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @is_empty_end(i8* %0, i8* %1) {
%3 = tail call i8* @eat_space_end(i8* %0, i8* %1)
%4 = icmp ult i8* %3, %1
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 13
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = icmp eq i8 %6, 10
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %5, %8, %2
%12 = phi i32 [ 0, %2 ], [ 1, %5 ], [ %10, %8 ]
ret i32 %12
}
struct ir_ncode *get_code_by_name(struct ir_remote *remote, char *name) {
  return (0);
}


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

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

LLVM IR (-O0):
%struct.ir_ncode = type opaque
%struct.ir_remote = type opaque
define %struct.ir_ncode* @get_code_by_name(%struct.ir_remote* %0, i8* %1) {
%3 = alloca %struct.ir_remote*
%4 = alloca i8*
store %struct.ir_remote* %0, %struct.ir_remote** %3
store i8* %1, i8** %4
ret %struct.ir_ncode* null
}

LLVM IR (-O2):
%struct.ir_ncode = type opaque
%struct.ir_remote = type opaque
define noalias %struct.ir_ncode* @get_code_by_name(%struct.ir_remote* nocapture readnone %0, i8* nocapture readnone %1) {
ret %struct.ir_ncode* null
}
/* Type definitions */
struct DSHashMap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ds_hashmap_put(struct DSHashMap *, void *, char *,
                                  int /*<<< orphan*/, int);
void ds_hashmap_put_str(struct DSHashMap *hash, char *key, void *data) {
  ds_hashmap_put(hash, data, key, 0, 2);
}


x86 assembly (clang, -O0):
<ds_hashmap_put_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x2,%r8d
call   1030 <ds_hashmap_put@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds_hashmap_put_str>:
mov    %rsi,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
mov    $0x2,%r8d
jmp    1030 <ds_hashmap_put@plt>

LLVM IR (-O0):
%struct.DSHashMap = type { i32 }
define void @ds_hashmap_put_str(%struct.DSHashMap* %0, i8* %1, i8* %2) {
%4 = alloca %struct.DSHashMap*
%5 = alloca i8*
%6 = alloca i8*
store %struct.DSHashMap* %0, %struct.DSHashMap** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.DSHashMap*, %struct.DSHashMap** %4
%8 = load i8*, i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @ds_hashmap_put(%struct.DSHashMap* %7, i8* %8, i8* %9, i32 0, i32 2)
ret void
}

LLVM IR (-O2):
%struct.DSHashMap = type { i32 }
define void @ds_hashmap_put_str(%struct.DSHashMap* %0, i8* %1, i8* %2) {
%4 = tail call i32 @ds_hashmap_put(%struct.DSHashMap* %0, i8* %2, i8* %1, i32 0, i32 2)
ret void
}
struct STU *link_order(struct STU *head) {
  return head;
}


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

x86 assembly (clang, -O2):
<link_order>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
%struct.STU = type opaque
define %struct.STU* @link_order(%struct.STU* readnone returned %0) {
ret %struct.STU* %0
}
void Draw_SetRed(void) {}


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

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

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

LLVM IR (-O2):
define void @Draw_SetRed() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ convert();
int main(int argc, char **argv) {
  convert();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @convert()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @convert()
ret i32 0
}
void XRemoveConnectionWatch() {}


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

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

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

LLVM IR (-O2):
define void @XRemoveConnectionWatch() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_name(char *, int);
int from_desktops(int comments) {
  get_name("/usr/share/applications", 0x10 | (comments ? 0x20 : 0));
  return 0;
}


x86 assembly (clang, -O0):
<from_desktops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
xor    %esi,%esi
mov    $0x20,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
or     $0x10,%esi
lea    0xecb(%rip),%rdi
call   1030 <get_name@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<from_desktops>:
push   %rax
xor    %esi,%esi
test   %edi,%edi
setne  %sil
shl    $0x5,%esi
or     $0x10,%esi
lea    0xeda(%rip),%rdi
call   1030 <get_name@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"/usr/share/applications\00"
define i32 @from_desktops(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 32, i32 0
%7 = or i32 16, %6
%8 = call i32 @get_name(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"/usr/share/applications\00"
define i32 @from_desktops(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 16, i32 48
%4 = tail call i32 @get_name(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
int IsLeapYear(int year) {
  return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0));
}


x86 assembly (clang, -O0):
<IsLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1134 <IsLeapYear+0x34>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x5(%rbp)
jne    1148 <IsLeapYear+0x48>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsLeapYear>:
test   $0x3,%dil
jne    112c <IsLeapYear+0x2c>
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%ecx
mov    %edi,%edx
mov    $0x1,%eax
sub    %ecx,%edx
je     112c <IsLeapYear+0x2c>
ret
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @IsLeapYear(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 4
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = srem i32 %7, 100
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6, %1
%11 = load i32, i32* %2
%12 = srem i32 %11, 400
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ true, %6 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @IsLeapYear(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp ne i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp eq i32 %4, 0
%6 = or i1 %3, %5
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = srem i32 %0, 400
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 1, %1 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ pr_info(char *);
int myinit(void) {
  pr_info("hello init\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"hello init\0A\00"
define i32 @myinit() {
%1 = call i32 @pr_info(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello init\0A\00"
define i32 @myinit() {
%1 = tail call i32 @pr_info(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ GetStringSize114(char const *);
void getstringsize(const char *s) { GetStringSize114(s); }


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

x86 assembly (clang, -O2):
<getstringsize>:
jmp    1030 <GetStringSize114@plt>

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

LLVM IR (-O2):
define void @getstringsize(i8* %0) {
%2 = tail call i32 @GetStringSize114(i8* %0)
ret void
}
unsigned cpu_uint16_make_uint16(unsigned v0) { return v0; }


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

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

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

LLVM IR (-O2):
define i32 @cpu_uint16_make_uint16(i32 returned %0) {
ret i32 %0
}
void l2_loop_overflow_Bad(int length) {
  int i;
  char a[length];
  for (i = length - 1; i >= 0; i--) {
    a[i + 1] = 'O';
  }
}


x86 assembly (clang, -O0):
<l2_loop_overflow_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1163 <l2_loop_overflow_Bad+0x63>
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x4f,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <l2_loop_overflow_Bad+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @l2_loop_overflow_Bad(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %4
%9 = alloca i8, i64 %7
store i64 %7, i64* %5
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %3
br label %12
12: ; preds = %20, %1
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %9, i64 %18
store i8 79, i8* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %3
%22 = add nsw i32 %21, -1
store i32 %22, i32* %3
br label %12
23: ; preds = %12
%24 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
define void @l2_loop_overflow_Bad(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
void handle_error(const char *msg) {
  if (errno != 0)
    perror(msg);
  else
    fprintf(stderr, "Error: %s\n", msg);
}


x86 assembly (clang, -O0):
<handle_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
cmpq   $0x0,(%rax)
je     114b <handle_error+0x2b>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
jmp    1164 <handle_error+0x44>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_error>:
mov    %rdi,%rdx
mov    0x2eae(%rip),%rax
cmpq   $0x0,(%rax)
jne    1145 <handle_error+0x25>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
jmp    1030 <fprintf@plt>
mov    %rdx,%rdi
jmp    1040 <perror@plt>

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

LLVM IR (-O2):
@errno = global i64 0
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @handle_error(i8* %0) {
%2 = load i64, i64* @errno
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* %0)
br label %9
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %6, %4
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ByteSwap32(uint32_t value) {
  return (value >> 24) | ((value >> 8) & 0x0000ff00) |
         ((value << 8) & 0x00ff0000) | (value << 24);
}


x86 assembly (clang, -O0):
<ByteSwap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff0000,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ByteSwap32>:
mov    %edi,%eax
sar    $0x18,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0xff00,%ecx
mov    %edi,%edx
shl    $0x8,%edx
and    $0xff0000,%edx
shl    $0x18,%edi
or     %edi,%eax
or     %ecx,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @ByteSwap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 24
%5 = load i32, i32* %2
%6 = ashr i32 %5, 8
%7 = and i32 %6, 65280
%8 = or i32 %4, %7
%9 = load i32, i32* %2
%10 = shl i32 %9, 8
%11 = and i32 %10, 16711680
%12 = or i32 %8, %11
%13 = load i32, i32* %2
%14 = shl i32 %13, 24
%15 = or i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @ByteSwap32(i32 %0) {
%2 = ashr i32 %0, 24
%3 = lshr i32 %0, 8
%4 = and i32 %3, 65280
%5 = shl i32 %0, 8
%6 = and i32 %5, 16711680
%7 = shl i32 %0, 24
%8 = or i32 %7, %2
%9 = or i32 %8, %4
%10 = or i32 %9, %6
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ path;

/* Variables and functions */
int /*<<< orphan*/ _fullpath(char *, char const *, int);
scalar_t__ strcasecmp(char const *, int /*<<< orphan*/);
int isabspath(const char *filename) {
  char path[260 + 1];
  return (strcasecmp(filename, _fullpath(path, filename, sizeof(path))) == 0);
}


x86 assembly (clang, -O0):
<isabspath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x105,%edx
call   1040 <_fullpath@plt>
mov    -0x118(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isabspath>:
push   %rbx
sub    $0x110,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x105,%edx
call   1040 <_fullpath@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isabspath(i8* %0) {
%2 = alloca i8*
%3 = alloca [261 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [261 x i8], [261 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @_fullpath(i8* %5, i8* %6, i32 261)
%8 = call i64 @strcasecmp(i8* %4, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isabspath(i8* %0) {
%2 = alloca [261 x i8]
%3 = getelementptr inbounds [261 x i8], [261 x i8]* %2, i64 0, i64 0
%4 = call i32 @_fullpath(i8* %3, i8* %0, i32 261)
%5 = call i64 @strcasecmp(i8* %0, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
void gtk_calendar_clear_marks() {}


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

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

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

LLVM IR (-O2):
define void @gtk_calendar_clear_marks() {
ret void
}
/* Variables and functions */
char *strstr(char const *, char const *);
int strindex(const char *haystack, const char *needle) {
  int result;
  char *p;
  if ((p = strstr(haystack, needle)) != NULL) {
    result = p - haystack;
    return result;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<strindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1154 <strindex+0x44>
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <strindex+0x4b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strindex>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strstr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @strindex(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i8* @strstr(i8* %8, i8* %9)
store i8* %10, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i8*, i8** %7
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %21
20: ; preds = %2
store i32 -1, i32* %3
br label %21
21: ; preds = %20, %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @strindex(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
/* Type definitions */
struct timeval {
  long tv_sec;
  long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double getTime() {
  double reta, retb, ret;
  struct timeval timev;
  long cur_sec, cur_usec;
  gettimeofday(&timev, NULL);
  cur_sec = timev.tv_sec;
  cur_usec = timev.tv_usec;
  reta = (double)(cur_sec);
  retb = (double)(cur_usec);
  ret = reta + retb / 1000000;
  return ret;
}


x86 assembly (clang, -O0):
<getTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
cvtsi2sdq -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
cvtsi2sdq -0x38(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xea3(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x8(%rsp),%xmm1
cvtsi2sdq 0x10(%rsp),%xmm0
divsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @getTime() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca %struct.timeval
%5 = alloca i64
%6 = alloca i64
%7 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%9 = load i64, i64* %8
store i64 %9, i64* %5
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%11 = load i64, i64* %10
store i64 %11, i64* %6
%12 = load i64, i64* %5
%13 = sitofp i64 %12 to double
store double %13, double* %1
%14 = load i64, i64* %6
%15 = sitofp i64 %14 to double
store double %15, double* %2
%16 = load double, double* %1
%17 = load double, double* %2
%18 = fdiv double %17, 1.000000e+06
%19 = fadd double %16, %18
store double %19, double* %3
%20 = load double, double* %3
ret double %20
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @getTime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %5 to double
%9 = sitofp i64 %7 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %8
ret double %11
}
/* Type definitions */
struct conffile {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ conffile_del(struct conffile *);
int /*<<< orphan*/ free(struct conffile *);
void conffile_free(struct conffile *file) {
  conffile_del(file);
  free(file);
}


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

x86 assembly (clang, -O2):
<conffile_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <conffile_del@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.conffile = type { i32 }
define void @conffile_free(%struct.conffile* %0) {
%2 = alloca %struct.conffile*
store %struct.conffile* %0, %struct.conffile** %2
%3 = load %struct.conffile*, %struct.conffile** %2
%4 = call i32 @conffile_del(%struct.conffile* %3)
%5 = load %struct.conffile*, %struct.conffile** %2
%6 = call i32 @free(%struct.conffile* %5)
ret void
}

LLVM IR (-O2):
%struct.conffile = type { i32 }
define void @conffile_free(%struct.conffile* %0) {
%2 = tail call i32 @conffile_del(%struct.conffile* %0)
%3 = tail call i32 @free(%struct.conffile* %0)
ret void
}
float Minf(float a, float b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<Minf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <Minf+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <Minf+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Minf>:
minss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @Minf(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
void troca(int *p, int *q) {
  int temp;
  temp = *p;
  *p = *q;
  *q = temp;
}


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

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

LLVM IR (-O0):
define void @troca(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @troca(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
void makePie(float vals, float labels) {}


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

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

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

LLVM IR (-O2):
define void @makePie(float %0, float %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assertTrue(char *, int);
int /*<<< orphan*/ strcpy(char *, char const *);
void test_strcpy() {
  const char *src = "Hello brave world!";
  char dest[100];
  strcpy(dest, src);
  assertTrue("dest[0] == 'H'", dest[0] == 'H');
  ;
}


x86 assembly (clang, -O0):
<test_strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
movsbl -0x70(%rbp),%eax
cmp    $0x48,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xebd(%rip),%rdi
call   1040 <assertTrue@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strcpy>:
sub    $0x68,%rsp
lea    0xed5(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
xor    %esi,%esi
cmpb   $0x48,(%rsp)
sete   %sil
lea    0xecf(%rip),%rdi
call   1040 <assertTrue@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Hello brave world!\00"
@.str.1 = [15 x i8] c"dest[0] == 'H'\00"
define void @test_strcpy() {
%1 = alloca i8*
%2 = alloca [100 x i8]
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = load i8*, i8** %1
%5 = call i32 @strcpy(i8* %3, i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 72
%10 = zext i1 %9 to i32
%11 = call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Hello brave world!\00"
@.str.1 = [15 x i8] c"dest[0] == 'H'\00"
define void @test_strcpy() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 72
%6 = zext i1 %5 to i32
%7 = call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
int Rand_div(int);
int /*<<< orphan*/ gain_random_corruption(int /*<<< orphan*/);
int /*<<< orphan*/ lose_corruption(int /*<<< orphan*/);
void corrupt_corrupted(void) {
  if (((Rand_div(100)) < (45))) {
    lose_corruption(0);
  } else {
    gain_random_corruption(0);
  }
  return;
}


x86 assembly (clang, -O0):
<corrupt_corrupted>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
call   1030 <Rand_div@plt>
cmp    $0x2d,%eax
jge    1153 <corrupt_corrupted+0x23>
xor    %edi,%edi
call   1040 <lose_corruption@plt>
jmp    115a <corrupt_corrupted+0x2a>
xor    %edi,%edi
call   1050 <gain_random_corruption@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<corrupt_corrupted>:
push   %rax
mov    $0x64,%edi
call   1030 <Rand_div@plt>
xor    %edi,%edi
cmp    $0x2c,%eax
jg     1148 <corrupt_corrupted+0x18>
pop    %rax
jmp    1040 <lose_corruption@plt>
pop    %rax
jmp    1050 <gain_random_corruption@plt>

LLVM IR (-O0):
define void @corrupt_corrupted() {
%1 = call i32 @Rand_div(i32 100)
%2 = icmp slt i32 %1, 45
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @lose_corruption(i32 0)
br label %7
5: ; preds = %0
%6 = call i32 @gain_random_corruption(i32 0)
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
define void @corrupt_corrupted() {
%1 = tail call i32 @Rand_div(i32 100)
%2 = icmp slt i32 %1, 45
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @lose_corruption(i32 0)
br label %7
5: ; preds = %0
%6 = tail call i32 @gain_random_corruption(i32 0)
br label %7
7: ; preds = %5, %3
ret void
}
int isprint(int c) { return c >= ' ' && c <= '~'; }


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isprint+0x20>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ signed_zero_inf();
main() { signed_zero_inf(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @signed_zero_inf()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @signed_zero_inf()
ret i32 0
}
void wifi_evt_ethernet_link_status(
    const struct wifi_msg_ethernet_link_status_evt_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_ethernet_link_status_evt_t = type opaque
define void @wifi_evt_ethernet_link_status(%struct.wifi_msg_ethernet_link_status_evt_t* nocapture %0) {
ret void
}
int test_imm_86int32_mem(int *val) {
  return ((*val) & (0x86 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_86int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 134
%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_86int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 134
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void __configure_rx_address(uint32_t addr) {
  uint32_t prefix0 = (*(volatile uint32_t *)(0x524 + (0x40001000)));
  prefix0 &= 0xFFFF00FF;
  prefix0 |= (addr >> 24) << 8;
  uint32_t base1 = addr << 8;
  (*(volatile uint32_t *)(0x520 + (0x40001000))) = base1;
  (*(volatile uint32_t *)(0x524 + (0x40001000))) = prefix0;
  (*(volatile uint32_t *)(0x530 + (0x40001000))) = 1 << 1;
}


x86 assembly (clang, -O0):
<__configure_rx_address>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x40001524,%eax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffff00ff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x40001520,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    $0x40001524,%eax
mov    %ecx,(%rax)
mov    $0x40001530,%eax
movl   $0x2,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__configure_rx_address>:
mov    $0xffff00ff,%eax
and    0x40001524,%eax
mov    %edi,%ecx
sar    $0x10,%ecx
and    $0xffffff00,%ecx
or     %eax,%ecx
shl    $0x8,%edi
mov    %edi,0x40001520
mov    %ecx,0x40001524
movl   $0x2,0x40001530
ret

LLVM IR (-O0):
define void @__configure_rx_address(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load volatile i32, i32* inttoptr (i64 1073747236 to i32*)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, -65281
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = ashr i32 %8, 24
%10 = shl i32 %9, 8
%11 = load i32, i32* %3
%12 = or i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = shl i32 %13, 8
store i32 %14, i32* %4
%15 = load i32, i32* %4
store volatile i32 %15, i32* inttoptr (i64 1073747232 to i32*)
%16 = load i32, i32* %3
store volatile i32 %16, i32* inttoptr (i64 1073747236 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073747248 to i32*)
ret void
}

LLVM IR (-O2):
define void @__configure_rx_address(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1073747236 to i32*)
%3 = and i32 %2, -65281
%4 = ashr i32 %0, 16
%5 = and i32 %4, -256
%6 = or i32 %3, %5
%7 = shl i32 %0, 8
store volatile i32 %7, i32* inttoptr (i64 1073747232 to i32*)
store volatile i32 %6, i32* inttoptr (i64 1073747236 to i32*)
store volatile i32 2, i32* inttoptr (i64 1073747248 to i32*)
ret void
}
float getMax(float a, float b, float c) {
  if ((a > b) && (a > c))
    return a;
  else if ((b > a) && (b > c))
    return b;
  else
    return c;
}


x86 assembly (clang, -O0):
<getMax>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1140 <getMax+0x40>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1140 <getMax+0x40>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1177 <getMax+0x77>
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    116d <getMax+0x6d>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    116d <getMax+0x6d>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1177 <getMax+0x77>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMax>:
movaps %xmm1,%xmm3
maxss  %xmm2,%xmm3
movaps %xmm0,%xmm4
cmpltss %xmm1,%xmm4
andps  %xmm4,%xmm3
andnps %xmm2,%xmm4
orps   %xmm3,%xmm4
cmpltss %xmm0,%xmm1
cmpltss %xmm0,%xmm2
andps  %xmm2,%xmm0
andnps %xmm4,%xmm2
orps   %xmm2,%xmm0
andps  %xmm1,%xmm0
andnps %xmm4,%xmm1
orps   %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @getMax(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %5
%9 = load float, float* %6
%10 = fcmp ogt float %8, %9
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load float, float* %5
%13 = load float, float* %7
%14 = fcmp ogt float %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load float, float* %5
store float %16, float* %4
br label %29
17: ; preds = %11, %3
%18 = load float, float* %6
%19 = load float, float* %5
%20 = fcmp ogt float %18, %19
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load float, float* %6
%23 = load float, float* %7
%24 = fcmp ogt float %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load float, float* %6
store float %26, float* %4
br label %29
27: ; preds = %21, %17
%28 = load float, float* %7
store float %28, float* %4
br label %29
29: ; preds = %27, %25, %15
%30 = load float, float* %4
ret float %30
}

LLVM IR (-O2):
define float @getMax(float %0, float %1, float %2) {
%4 = fcmp ogt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = and i1 %4, %5
%7 = fcmp ogt float %1, %0
%8 = fcmp ogt float %1, %2
%9 = and i1 %7, %8
%10 = select i1 %9, float %1, float %2
%11 = select i1 %6, float %0, float %10
ret float %11
}
int f(int k, int i1, int j1) {
  int *f1;
  if (k)
    f1 = &i1;
  else
    f1 = &j1;
  i1 = 0;
  return *f1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1124 <f+0x24>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112c <f+0x2c>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
test   %edi,%edi
cmove  %edx,%eax
ret

LLVM IR (-O0):
define i32 @f(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* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store i32* %5, i32** %7
br label %12
11: ; preds = %3
store i32* %6, i32** %7
br label %12
12: ; preds = %11, %10
store i32 0, i32* %5
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i32 %2, i32 0
ret i32 %5
}
int int_div(int x, int y, int index) { return x / y; }


x86 assembly (clang, -O0):
<int_div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_div>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @int_div(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = sdiv i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @int_div(i32 %0, i32 %1, i32 %2) {
%4 = sdiv i32 %0, %1
ret i32 %4
}
int elf_hash(char *param1) {
  int o3;
  int o4;
  o3 = (int)*param1;
  o4 = 0;
  if (o3 != 0) {
    o4 = (o3 ^ (o3 & 0xf0000000) / 0x1000000) & !(o3 & 0xf0000000);
    o3 = (int)*(param1 + 1);
  }
  return o4;
}


x86 assembly (clang, -O0):
<elf_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115c <elf_hash+0x5c>
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
and    $0xf0000000,%ecx
shr    $0x18,%ecx
xor    %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0xf0000000,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<elf_hash>:
mov    (%rdi),%al
mov    %eax,%ecx
not    %cl
shr    $0x7,%cl
and    %al,%cl
xor    %edx,%edx
test   %al,%al
movzbl %cl,%eax
cmove  %edx,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @elf_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
store i32 %7, i32* %3
store i32 0, i32* %4
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = and i32 %12, -268435456
%14 = udiv i32 %13, 16777216
%15 = xor i32 %11, %14
%16 = load i32, i32* %3
%17 = and i32 %16, -268435456
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = and i32 %15, %20
store i32 %21, i32* %4
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
store i32 %25, i32* %3
br label %26
26: ; preds = %10, %1
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @elf_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = xor i8 %2, -1
%5 = lshr i8 %4, 7
%6 = and i8 %5, %2
%7 = select i1 %3, i8 0, i8 %6
%8 = zext i8 %7 to i32
ret i32 %8
}
int funccmp(const void *x1, const void *x2) {
  return (*(int *)x1 - *(int *)x2);
}


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

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

LLVM IR (-O0):
define i32 @funccmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @funccmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int f(int);
int /*<<< orphan*/ g();
int /*<<< orphan*/ h(int);
int main(void) {
  int *x, *y;
  for (int i = 0; i < 100; i++) {
    g();
    x[i] = f(y[i]);
    h(y[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    1192 <main+0x62>
mov    $0x0,%al
call   1050 <g@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <f@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <h@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <g@plt>
call   1030 <f@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @g()
%2 = tail call i32 @f(i32 undef)
unreachable
}