xunge/DecIR huggingface dataset:
int Check(int *array1, int *array2, int length) {
  for (int i = 0; i < length; i++) {
    if (!(array1[i] == array2[i]))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <Check+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     114a <Check+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1164 <Check+0x64>
jmp    114f <Check+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <Check+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Check>:
test   %edx,%edx
jle    113d <Check+0x3d>
mov    (%rdi),%ecx
mov    $0x1,%eax
cmp    (%rsi),%ecx
jne    113c <Check+0x3c>
mov    %edx,%r8d
mov    $0x1,%eax
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdx
cmp    %rax,%r8
je     1134 <Check+0x34>
mov    (%rdi,%rdx,4),%ecx
lea    0x1(%rdx),%rax
cmp    (%rsi,%rdx,4),%ecx
je     1120 <Check+0x20>
xor    %eax,%eax
cmp    %r8,%rdx
setb   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @Check(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %24
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = zext i32 %2 to i64
%8 = load i32, i32* %0
%9 = load i32, i32* %1
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %5, %14
%12 = phi i64 [ %20, %14 ], [ 1, %5 ]
%13 = icmp eq i64 %12, %7
br i1 %13, label %21, label %14
14: ; preds = %11
%15 = getelementptr inbounds i32, i32* %0, i64 %12
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %1, i64 %12
%18 = load i32, i32* %17
%19 = icmp eq i32 %16, %18
%20 = add nuw nsw i64 %12, 1
br i1 %19, label %11, label %21
21: ; preds = %11, %14
%22 = icmp ult i64 %12, %6
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %21, %5, %3
%25 = phi i32 [ 0, %3 ], [ 1, %5 ], [ %23, %21 ]
ret i32 %25
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void putl(const char *string) {
  while (*string != '\0')
    putchar(*string++);
}


x86 assembly (clang, -O0):
<putl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <putl+0x38>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <putl+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putl>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <putl+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putl+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putl(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @putchar(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BootFlashSaveOSSettings();
int /*<<< orphan*/ I2CPowerOff();
int /*<<< orphan*/ assertWriteEEPROM();
void PowerOff(void *ignored) {
  assertWriteEEPROM();
  BootFlashSaveOSSettings();
  I2CPowerOff();
}


x86 assembly (clang, -O0):
<PowerOff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <assertWriteEEPROM@plt>
mov    $0x0,%al
call   1050 <BootFlashSaveOSSettings@plt>
mov    $0x0,%al
call   1030 <I2CPowerOff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PowerOff>:
push   %rax
xor    %eax,%eax
call   1040 <assertWriteEEPROM@plt>
xor    %eax,%eax
call   1050 <BootFlashSaveOSSettings@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <I2CPowerOff@plt>

LLVM IR (-O0):
define void @PowerOff(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @assertWriteEEPROM()
%4 = call i32 (...) @BootFlashSaveOSSettings()
%5 = call i32 (...) @I2CPowerOff()
ret void
}

LLVM IR (-O2):
define void @PowerOff(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @assertWriteEEPROM()
%3 = tail call i32 (...) @BootFlashSaveOSSettings()
%4 = tail call i32 (...) @I2CPowerOff()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void no_segment_fault(void) { panic("exception(fault): segment not present"); }


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"exception(fault): segment not present\00"
define void @no_segment_fault() {
%1 = call i32 @panic(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"exception(fault): segment not present\00"
define void @no_segment_fault() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ aescmac();
int /*<<< orphan*/ aesecb();
int main(void) {
  aesecb();
  aescmac();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @aesecb()
%3 = call i32 (...) @aescmac()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @aesecb()
%2 = tail call i32 (...) @aescmac()
ret i32 0
}
/* Variables and functions */
char *strtok(char *, char const *);
char *gfstrtok_r(char *str, const char *delim,
                 char **saveptr __attribute__((unused))) {
  return strtok(str, delim);
}


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

x86 assembly (clang, -O2):
<gfstrtok_r>:
jmp    1030 <strtok@plt>

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

LLVM IR (-O2):
define i8* @gfstrtok_r(i8* %0, i8* nocapture %1, i8** nocapture readnone %2) {
%4 = tail call i8* @strtok(i8* %0, i8* %1)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ bar();
extern void __attribute__((gnu_)) check3(void) { bar(); }


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

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

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

LLVM IR (-O2):
define void @check3() {
%1 = tail call i32 (...) @bar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_1_putc(unsigned char);
void hc05_putc(unsigned char ch) {
  uart_1_putc(ch);
  return;
}


x86 assembly (clang, -O0):
<hc05_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <uart_1_putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hc05_putc>:
jmp    1030 <uart_1_putc@plt>

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

LLVM IR (-O2):
define void @hc05_putc(i8 zeroext %0) {
%2 = tail call i32 @uart_1_putc(i8 zeroext %0)
ret void
}
/* Variables and functions */
char const *fpmtoa(float);
const char *etxtoa(float etx) {
  return etx >= ((float)(1 << 30)) ? "INF" : fpmtoa(etx);
}


x86 assembly (clang, -O0):
<etxtoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xed6(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1143 <etxtoa+0x33>
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1151 <etxtoa+0x41>
movss  -0x4(%rbp),%xmm0
call   1030 <fpmtoa@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<etxtoa>:
ucomiss 0xee9(%rip),%xmm0
jae    111e <etxtoa+0xe>
jmp    1030 <fpmtoa@plt>
lea    0xedf(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"INF\00"
define i8* @etxtoa(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp oge float %3, 0x41D0000000000000
br i1 %4, label %5, label %6
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load float, float* %2
%8 = call i8* @fpmtoa(float %7)
br label %9
9: ; preds = %6, %5
%10 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %5 ], [ %8, %6 ]
ret i8* %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"INF\00"
define i8* @etxtoa(float %0) {
%2 = fcmp ult float %0, 0x41D0000000000000
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @fpmtoa(float %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %6
}
/* Variables and functions */
int *malloc(int);
void f1() {
  int *p = malloc(10);
  return;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    $0xa,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @f1() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 10)
store i32* %2, i32** %1
ret void
}

LLVM IR (-O2):
define void @f1() {
%1 = tail call i32* @malloc(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
void html_head(char *str) {
  puts("Content-type: text/html");
  puts("");
  if (str)
    printf("<html><head><title>%s</title></head>\n", str);
}


x86 assembly (clang, -O0):
<html_head>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
cmpq   $0x0,-0x8(%rbp)
je     115f <html_head+0x3f>
mov    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_head>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %rbx,%rbx
je     115f <html_head+0x2f>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Content-type: text/html\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [38 x i8] c"<html><head><title>%s</title></head>\0A\00"
define void @html_head(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Content-type: text/html\00"
@.str.2 = [38 x i8] c"<html><head><title>%s</title></head>\0A\00"
define void @html_head(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %1
ret void
}
int divRoundUp(int n, int s) { return (n / s) + (n % s > 0 ? 1 : 0); }


x86 assembly (clang, -O0):
<divRoundUp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %edx,%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovg  %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divRoundUp>:
mov    %edi,%eax
cltd
idiv   %esi
xor    %ecx,%ecx
test   %edx,%edx
setg   %cl
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @divRoundUp(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 = sdiv i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
%11 = icmp sgt i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
%14 = add nsw i32 %7, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @divRoundUp(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
%4 = srem i32 %0, %1
%5 = icmp sgt i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %3, %6
ret i32 %7
}
/* Type definitions */
struct ipr_ses_type_desc {
  int dummy;
};
struct ipr_ses_config_pg {
  int dummy;
};

/* Variables and functions */
struct ipr_ses_type_desc *ipr_get_elem(struct ipr_ses_config_pg *, int);
struct ipr_ses_type_desc *ipr_get_dev_elem(struct ipr_ses_config_pg *ses_cfg) {
  return ipr_get_elem(ses_cfg, 0x01);
}


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

x86 assembly (clang, -O2):
<ipr_get_dev_elem>:
mov    $0x1,%esi
jmp    1030 <ipr_get_elem@plt>

LLVM IR (-O0):
%struct.ipr_ses_type_desc = type { i32 }
%struct.ipr_ses_config_pg = type { i32 }
define %struct.ipr_ses_type_desc* @ipr_get_dev_elem(%struct.ipr_ses_config_pg* %0) {
%2 = alloca %struct.ipr_ses_config_pg*
store %struct.ipr_ses_config_pg* %0, %struct.ipr_ses_config_pg** %2
%3 = load %struct.ipr_ses_config_pg*, %struct.ipr_ses_config_pg** %2
%4 = call %struct.ipr_ses_type_desc* @ipr_get_elem(%struct.ipr_ses_config_pg* %3, i32 1)
ret %struct.ipr_ses_type_desc* %4
}

LLVM IR (-O2):
%struct.ipr_ses_type_desc = type { i32 }
%struct.ipr_ses_config_pg = type { i32 }
define %struct.ipr_ses_type_desc* @ipr_get_dev_elem(%struct.ipr_ses_config_pg* %0) {
%2 = tail call %struct.ipr_ses_type_desc* @ipr_get_elem(%struct.ipr_ses_config_pg* %0, i32 1)
ret %struct.ipr_ses_type_desc* %2
}
/* Variables and functions */
float math_sinf(float);
float call_sinf(float x) { return math_sinf(x); }


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

x86 assembly (clang, -O2):
<call_sinf>:
jmp    1030 <math_sinf@plt>

LLVM IR (-O0):
define float @call_sinf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @math_sinf(float %3)
ret float %4
}

LLVM IR (-O2):
define float @call_sinf(float %0) {
%2 = tail call float @math_sinf(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void timekeeping_array_destroy(void *array) { free(array); }


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

x86 assembly (clang, -O2):
<timekeeping_array_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @timekeeping_array_destroy(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main() {
  int i;
  for (i = 0; i < 1000; i++)
    foo(8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    114b <main+0x3b>
mov    $0x8,%edi
call   1030 <foo@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3e8,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x8,%edi
call   1030 <foo@plt>
add    $0xffffffff,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @foo(i32 8)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 1000
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
int is_in_array(float num, float *arr, int len) {
  for (int i = 0; i < len; i++) {
    if (arr[i] == num) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_in_array>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115f <is_in_array+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    114c <is_in_array+0x4c>
jp     114c <is_in_array+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1166 <is_in_array+0x66>
jmp    1151 <is_in_array+0x51>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1117 <is_in_array+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_array>:
test   %esi,%esi
jle    1115 <is_in_array+0x15>
movss  (%rdi),%xmm1
mov    $0x1,%eax
ucomiss %xmm0,%xmm1
jne    1118 <is_in_array+0x18>
jp     1118 <is_in_array+0x18>
ret
xor    %eax,%eax
ret
mov    %esi,%ecx
mov    $0x1,%eax
nop
mov    %rax,%rdx
cmp    %rax,%rcx
je     1138 <is_in_array+0x38>
movss  (%rdi,%rdx,4),%xmm1
lea    0x1(%rdx),%rax
ucomiss %xmm0,%xmm1
jne    1120 <is_in_array+0x20>
jp     1120 <is_in_array+0x20>
xor    %eax,%eax
cmp    %rcx,%rdx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_in_array(float %0, float* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %21
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = zext i32 %2 to i64
%8 = load float, float* %1
%9 = fcmp oeq float %8, %0
br i1 %9, label %21, label %10
10: ; preds = %5, %13
%11 = phi i64 [ %17, %13 ], [ 1, %5 ]
%12 = icmp eq i64 %11, %7
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = getelementptr inbounds float, float* %1, i64 %11
%15 = load float, float* %14
%16 = fcmp oeq float %15, %0
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %18, label %10
18: ; preds = %10, %13
%19 = icmp ult i64 %11, %6
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %18, %5, %3
%22 = phi i32 [ 0, %3 ], [ 1, %5 ], [ %20, %18 ]
ret i32 %22
}
unsigned char hex_to_bin(unsigned char n) {
  return (((n & 0xF0) >> 4) * 16) + (n & 0x0F);
}


x86 assembly (clang, -O0):
<hex_to_bin>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
shl    $0x4,%eax
movzbl -0x1(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @hex_to_bin(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 240
%6 = ashr i32 %5, 4
%7 = mul nsw i32 %6, 16
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = add nsw i32 %7, %10
%12 = trunc i32 %11 to i8
ret i8 %12
}

LLVM IR (-O2):
define zeroext i8 @hex_to_bin(i8 returned zeroext %0) {
ret i8 %0
}
int test_imm_D8uint8_reg(unsigned char val) {
  return ((val) & (-0xD8 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D8uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff28,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D8uint8_reg>:
test   $0x28,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D8uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -216
%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_D8uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 40
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void chomp(char *string) {
  while (*string && *string != '\n' && *string != '\r')
    string++;
  *string = 0;
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1142 <chomp+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     1142 <chomp+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1152 <chomp+0x52>
jmp    1163 <chomp+0x63>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <chomp+0x8>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
mov    $0x2401,%eax
jmp    1114 <chomp+0x14>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0xd,%rcx
ja     1110 <chomp+0x10>
bt     %rcx,%rax
jae    1110 <chomp+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @chomp(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 10, label %7
i8 13, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2, %2
store i8 0, i8* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test29_AvrPin_toggle__E();
void test29_Led_toggle__E() { test29_AvrPin_toggle__E(); }


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

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

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

LLVM IR (-O2):
define void @test29_Led_toggle__E() {
%1 = tail call i32 (...) @test29_AvrPin_toggle__E()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *, void *);
void process_pointer(void **Root, const void *Meta) {
  printf("process_root[%p] = %p\n", (void *)Root, (void *)*Root);
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"process_root[%p] = %p\0A\00"
define void @process_pointer(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 i8*
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"process_root[%p] = %p\0A\00"
define void @process_pointer(i8** %0, i8* nocapture readnone %1) {
%3 = bitcast i8** %0 to i8*
%4 = load i8*, i8** %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
ret void
}
void hw_config_temp() {}


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

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

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

LLVM IR (-O2):
define void @hw_config_temp() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
scalar_t__ strcasecmp(char *, char *);
void strcasecmp_1() {
  char *x = "Bcd";
  char *y = "abc";
  clang_analyzer_eval(strcasecmp(x, y) > 0);
}


x86 assembly (clang, -O0):
<strcasecmp_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcasecmp_1>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
pop    %rax
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"Bcd\00"
@.str.1 = [4 x i8] c"abc\00"
define void @strcasecmp_1() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i64 @strcasecmp(i8* %3, i8* %4)
%6 = icmp sgt i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @clang_analyzer_eval(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Bcd\00"
@.str.1 = [4 x i8] c"abc\00"
define void @strcasecmp_1() {
%1 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp sgt i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
ret void
}
int convertToFahr(int celsius) { return celsius * (9.0 / 5.0) + 32.0; }


x86 assembly (clang, -O0):
<convertToFahr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertToFahr>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @convertToFahr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = call double @llvm.fmuladd.f64(double %4, double 1.800000e+00, double 3.200000e+01)
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @convertToFahr(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptosi double %3 to i32
ret i32 %4
}
int f2(int a, int b) { return (a > b) - (a < b); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
cmp    -0x8(%rbp),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %esi,%edi
setg   %al
setl   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f2(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 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
%12 = zext i1 %11 to i32
%13 = sub nsw i32 %8, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @f2(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = zext i1 %3 to i32
%5 = icmp slt i32 %0, %1
%6 = sext i1 %5 to i32
%7 = add nsw i32 %6, %4
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct stat {
  int /*<<< orphan*/ st_mtime;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
time_t mtime(const char *file) {
  struct stat buf;
  if (stat(file, &buf) < 0)
    return 0;
  return buf.st_mtime;
}


x86 assembly (clang, -O0):
<mtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    113f <mtime+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1145 <mtime+0x35>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtime>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1126 <mtime+0x16>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @mtime(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %12
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @mtime(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 0, i32 %7
ret i32 %8
}
/* Variables and functions */
int strlen(char *);
int remove_slash(char *buf) {
  int len;
  len = strlen(buf);
  if (len > 1 && buf[len - 1] == '/') {
    buf[--len] = '\0';
  }
  return len;
}


x86 assembly (clang, -O0):
<remove_slash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1160 <remove_slash+0x50>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1160 <remove_slash+0x50>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_slash>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     112f <remove_slash+0x1f>
mov    %eax,%ecx
add    $0xffffffff,%ecx
cmpb   $0x2f,(%rbx,%rcx,1)
jne    112f <remove_slash+0x1f>
movb   $0x0,(%rbx,%rcx,1)
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @remove_slash(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 1
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = add nsw i32 %2, -1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 47
br i1 %9, label %10, label %11
10: ; preds = %4
store i8 0, i8* %7
br label %11
11: ; preds = %10, %4, %1
%12 = phi i32 [ %5, %10 ], [ %2, %4 ], [ %2, %1 ]
ret i32 %12
}
double fabs(double num) {
  if (num >= 0.0) {
    return num;
  } else {
    return -num;
  }
}


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112a <fabs+0x2a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    114b <fabs+0x4b>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
cmpnlesd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fabs(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load double, double* %3
store double %7, double* %2
br label %11
8: ; preds = %1
%9 = load double, double* %3
%10 = fneg double %9
store double %10, double* %2
br label %11
11: ; preds = %8, %6
%12 = load double, double* %2
ret double %12
}

LLVM IR (-O2):
define double @fabs(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
int squareofsum(int limit) {
  int sum = 0;
  int i;
  for (i = 1; i <= limit; i++) {
    sum += i;
  }
  return (sum * sum);
}


x86 assembly (clang, -O0):
<squareofsum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <squareofsum+0x38>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <squareofsum+0x15>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<squareofsum>:
test   %edi,%edi
jle    111b <squareofsum+0x1b>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
imul   %eax,%eax
ret
xor    %eax,%eax
imul   %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @squareofsum(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
%16 = mul nsw i32 %15, %15
ret i32 %16
}
void fun(int *y) {
  int x = 1;
  x = x + 1;
  ;
  x = x + 1;
  *y = x;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
movl   $0x3,(%rdi)
ret

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

LLVM IR (-O2):
define void @fun(i32* nocapture writeonly %0) {
store i32 3, i32* %0
ret void
}
/* Variables and functions */
int abs(int);
int main() { return !(abs(-15) == 15); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffff1,%edi
call   1030 <abs@plt>
cmp    $0xf,%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @abs(i32 -15)
%3 = icmp eq i32 %2, 15
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void uninit_in_loop() {
  int produce(void);
  void consume(int);
  for (int n = 0; n < 100; ++n) {
    int k;
    consume(k);
    k = produce();
  }
}


x86 assembly (clang, -O0):
<uninit_in_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1157 <uninit_in_loop+0x37>
mov    -0x8(%rbp),%edi
call   1040 <consume@plt>
call   1030 <produce@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <uninit_in_loop+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @uninit_in_loop() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @produce()
store i32 %8, i32* %2
br label %9
9: ; preds = %6
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long _get_ncpus_proc_cpuinfo(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
long get_ncpus_proc_cpuinfo(const char *path) {
  FILE *cpuinfo_fp = fopen(path, "r");
  if (cpuinfo_fp == NULL) {
    return -1;
  }
  long ncpus = _get_ncpus_proc_cpuinfo(cpuinfo_fp);
  fclose(cpuinfo_fp);
  return ncpus;
}


x86 assembly (clang, -O0):
<get_ncpus_proc_cpuinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1168 <get_ncpus_proc_cpuinfo+0x38>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1186 <get_ncpus_proc_cpuinfo+0x56>
mov    -0x18(%rbp),%rdi
call   1040 <_get_ncpus_proc_cpuinfo@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ncpus_proc_cpuinfo>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1160 <get_ncpus_proc_cpuinfo+0x30>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <_get_ncpus_proc_cpuinfo@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rax
jmp    1167 <get_ncpus_proc_cpuinfo+0x37>
mov    $0xffffffffffffffff,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i64 @get_ncpus_proc_cpuinfo(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i64
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %4
%8 = load i32*, i32** %4
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i64 -1, i64* %2
br label %17
11: ; preds = %1
%12 = load i32*, i32** %4
%13 = call i64 @_get_ncpus_proc_cpuinfo(i32* %12)
store i64 %13, i64* %5
%14 = load i32*, i32** %4
%15 = call i32 @fclose(i32* %14)
%16 = load i64, i64* %5
store i64 %16, i64* %2
br label %17
17: ; preds = %11, %10
%18 = load i64, i64* %2
ret i64 %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i64 @get_ncpus_proc_cpuinfo(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @_get_ncpus_proc_cpuinfo(i32* %2)
%6 = tail call i32 @fclose(i32* %2)
br label %7
7: ; preds = %1, %4
%8 = phi i64 [ %5, %4 ], [ -1, %1 ]
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ close(int /*<<< orphan*/);
void test_main(void) { close(0); }


x86 assembly (clang, -O0):
<test_main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <close@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_main>:
xor    %edi,%edi
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @test_main() {
%1 = call i32 @close(i32 0)
ret void
}

LLVM IR (-O2):
define void @test_main() {
%1 = tail call i32 @close(i32 0)
ret void
}
int systemd_sock_get(struct Server *s) {
  int n = 0;
  return n;
}


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

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

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

LLVM IR (-O2):
%struct.Server = type opaque
define i32 @systemd_sock_get(%struct.Server* nocapture readnone %0) {
ret i32 0
}
void page_tracker_change_tracker(struct page *new_page, struct page *old_page) {
}


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

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

LLVM IR (-O0):
%struct.page = type opaque
define void @page_tracker_change_tracker(%struct.page* %0, %struct.page* %1) {
%3 = alloca %struct.page*
%4 = alloca %struct.page*
store %struct.page* %0, %struct.page** %3
store %struct.page* %1, %struct.page** %4
ret void
}

LLVM IR (-O2):
%struct.page = type opaque
define void @page_tracker_change_tracker(%struct.page* nocapture %0, %struct.page* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ND_free(void *to_free, void *userdata) { free(to_free); }


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

x86 assembly (clang, -O2):
<ND_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @ND_free(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 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @ND_free(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
y() { return 5; }


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

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

LLVM IR (-O0):
define i32 @y() {
ret i32 5
}

LLVM IR (-O2):
define i32 @y() {
ret i32 5
}