xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ my_encrypt(unsigned char *, unsigned char *, int);
int set_len(unsigned char *, int);
int pack(unsigned char *msg, const char *buf, int len) {
  int pad = set_len(msg, len);
  my_encrypt((unsigned char *)buf, msg + 16, len + pad);
  return len + pad + 16;
}


x86 assembly (clang, -O0):
<pack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <set_len@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x10,%rsi
mov    -0x14(%rbp),%edx
add    -0x18(%rbp),%edx
call   1030 <my_encrypt@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    $0x10,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%esi
call   1040 <set_len@plt>
mov    %eax,%r12d
add    $0x10,%rbx
lea    (%r12,%r15,1),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <my_encrypt@plt>
lea    (%r12,%r15,1),%eax
add    $0x10,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @pack(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = call i32 @set_len(i8* %8, i32 %9)
store i32 %10, i32* %7
%11 = load i8*, i8** %5
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 16
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = add nsw i32 %14, %15
%17 = call i32 @my_encrypt(i8* %11, i8* %13, i32 %16)
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = add nsw i32 %18, %19
%21 = add nsw i32 %20, 16
ret i32 %21
}

LLVM IR (-O2):
define i32 @pack(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @set_len(i8* %0, i32 %2)
%5 = getelementptr inbounds i8, i8* %0, i64 16
%6 = add nsw i32 %4, %2
%7 = tail call i32 @my_encrypt(i8* %1, i8* %5, i32 %6)
%8 = add nsw i32 %6, 16
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ p16_adc();
int /*<<< orphan*/ p16_int_pin();
int /*<<< orphan*/ p16_int_portb();
int /*<<< orphan*/ p16_mssp();
int /*<<< orphan*/ p16_tmr0();
int /*<<< orphan*/ p16_tmr1();
int /*<<< orphan*/ p16_tmr2();
int /*<<< orphan*/ p16_wdt();
int /*<<< orphan*/ serial(int /*<<< orphan*/);
void PIC16F777_periferic(void) {
  p16_mssp();
  p16_adc();
  p16_int_pin();
  p16_int_portb();
  p16_tmr0();
  p16_wdt();
  p16_tmr1();
  p16_tmr2();
  serial(0);
}


x86 assembly (clang, -O0):
<PIC16F777_periferic>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   10a0 <p16_mssp@plt>
mov    $0x0,%al
call   1060 <p16_adc@plt>
mov    $0x0,%al
call   10b0 <p16_int_pin@plt>
mov    $0x0,%al
call   1070 <p16_int_portb@plt>
mov    $0x0,%al
call   1030 <p16_tmr0@plt>
mov    $0x0,%al
call   1090 <p16_wdt@plt>
mov    $0x0,%al
call   1080 <p16_tmr1@plt>
mov    $0x0,%al
call   1040 <p16_tmr2@plt>
xor    %edi,%edi
call   1050 <serial@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PIC16F777_periferic>:
push   %rax
xor    %eax,%eax
call   10a0 <p16_mssp@plt>
xor    %eax,%eax
call   1060 <p16_adc@plt>
xor    %eax,%eax
call   10b0 <p16_int_pin@plt>
xor    %eax,%eax
call   1070 <p16_int_portb@plt>
xor    %eax,%eax
call   1030 <p16_tmr0@plt>
xor    %eax,%eax
call   1090 <p16_wdt@plt>
xor    %eax,%eax
call   1080 <p16_tmr1@plt>
xor    %eax,%eax
call   1040 <p16_tmr2@plt>
xor    %edi,%edi
pop    %rax
jmp    1050 <serial@plt>

LLVM IR (-O0):
define void @PIC16F777_periferic() {
%1 = call i32 (...) @p16_mssp()
%2 = call i32 (...) @p16_adc()
%3 = call i32 (...) @p16_int_pin()
%4 = call i32 (...) @p16_int_portb()
%5 = call i32 (...) @p16_tmr0()
%6 = call i32 (...) @p16_wdt()
%7 = call i32 (...) @p16_tmr1()
%8 = call i32 (...) @p16_tmr2()
%9 = call i32 @serial(i32 0)
ret void
}

LLVM IR (-O2):
define void @PIC16F777_periferic() {
%1 = tail call i32 (...) @p16_mssp()
%2 = tail call i32 (...) @p16_adc()
%3 = tail call i32 (...) @p16_int_pin()
%4 = tail call i32 (...) @p16_int_portb()
%5 = tail call i32 (...) @p16_tmr0()
%6 = tail call i32 (...) @p16_wdt()
%7 = tail call i32 (...) @p16_tmr1()
%8 = tail call i32 (...) @p16_tmr2()
%9 = tail call i32 @serial(i32 0)
ret void
}
double f(double x) { return 3 * x * x * x - 2 * x - 4; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xee0(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeac(%rip),%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm0
subsd  %xmm0,%xmm1
addsd  0xee4(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 3.000000e+00, %3
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = load double, double* %2
%8 = load double, double* %2
%9 = fmul double 2.000000e+00, %8
%10 = fneg double %9
%11 = call double @llvm.fmuladd.f64(double %6, double %7, double %10)
%12 = fsub double %11, 4.000000e+00
ret double %12
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = fmul double %0, 3.000000e+00
%3 = fmul double %2, %0
%4 = fmul double %0, -2.000000e+00
%5 = tail call double @llvm.fmuladd.f64(double %3, double %0, double %4)
%6 = fadd double %5, -4.000000e+00
ret double %6
}
/* Variables and functions */
int strlen(char *);
char tolower(char);
void lowerstr(char *value) {
  int i;
  for (i = 0; i < strlen(value); i++)
    value[i] = tolower(value[i]);
}


x86 assembly (clang, -O0):
<lowerstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    117b <lowerstr+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <lowerstr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowerstr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1161 <lowerstr+0x41>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <lowerstr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @lowerstr(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call signext i8 @tolower(i8 signext %7)
store i8 %8, i8* %6
%9 = add nuw nsw i64 %5, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foobar();
int /*<<< orphan*/ nothing();
void f() {
  for (;;)
    nothing();
  foobar();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <f+0x9>
mov    $0x0,%al
call   1030 <nothing@plt>
jmp    1119 <f+0x9>

x86 assembly (clang, -O2):
<f>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <nothing@plt>
jmp    1120 <f+0x10>

LLVM IR (-O0):
define void @f() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @nothing()
br label %1
}

LLVM IR (-O2):
define void @f() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @nothing()
br label %1
}
R0R1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ r0 = r1; }


x86 assembly (clang, -O0):
<R0R1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @R0R1(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* %9
store i32 %14, i32* %8
%15 = load i32, i32* %7
ret i32 %15
}

LLVM IR (-O2):
define i32 @R0R1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *prog) {
  printf("usage: %s [-h] [ -i file]\n", prog);
  printf("-i file\t\t\tthe input file\n");
  printf("-h \t\t\thelp\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"usage: %s [-h] [ -i file]\0A\00"
@.str.1 = [26 x i8] c"-i file\09\09\09the input file\0A\00"
@.str.2 = [12 x i8] c"-h \09\09\09help\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"usage: %s [-h] [ -i file]\0A\00"
@str = [25 x i8] c"-i file\09\09\09the input file\00"
@str.3 = [11 x i8] c"-h \09\09\09help\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.3, i64 0, i64 0))
ret void
}
void handle_33(int sig) {}


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

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

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

LLVM IR (-O2):
define void @handle_33(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printlinkedlisttofile();
int /*<<< orphan*/ yyparse();
int main(void) {
  yyparse();
  printlinkedlisttofile();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yyparse()
%2 = tail call i32 (...) @printlinkedlisttofile()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xfc() {
  Assert_real((iscntrl(252) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              1265, ("iscntrl should be 0 for 0xfc"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0xfc>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfc,%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4f1,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0xfc>:
push   %rax
mov    $0xfc,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4f1,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xfc\00"
define void @t_iscntrl_0xfc() {
%1 = call i64 @iscntrl(i32 252)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1265, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xfc\00"
define void @t_iscntrl_0xfc() {
%1 = tail call i64 @iscntrl(i32 252)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1265, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void WTSFreeMemory(void *pMemory) {
  if (pMemory != 0) {
    free(pMemory);
  }
}


x86 assembly (clang, -O0):
<WTSFreeMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <WTSFreeMemory+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WTSFreeMemory>:
test   %rdi,%rdi
je     111a <WTSFreeMemory+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @WTSFreeMemory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @WTSFreeMemory(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void XNullHandler(void *NullParameter) {}


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

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

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

LLVM IR (-O2):
define void @XNullHandler(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int arr[] = {1, 2, 3, 4};
  if (-1 < sizeof(arr) / sizeof(arr[0]))
    printf("Hello world!\n");
  else
    printf("Error!\n");
  if ((double)-1 < sizeof(arr) / sizeof(arr[0]))
    printf("Hello world!\n");
  else
    printf("Error!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.arr = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [8 x i8] c"Error!\0A\00"
@.str.1 = [14 x i8] c"Hello world!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
store i32 0, i32* %1
%3 = bitcast [4 x i32]* %2 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Error!\00"
@str.2 = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mp_msg_c(int, char *, int);
int check_bps(int bps) {
  if (bps != 4 && bps != 3 && bps != 2 && bps != 1) {
    mp_msg_c(((37) << 8) |
                 ((((-2) < 0) ? ((-2) + 3) : (((-2) == 0) ? 4 : ((-2) + 5)))),
             "[format] The number of bytes per sample"
             " must be 1, 2, 3 or 4. Current value is %i \n",
             bps);
    return -2;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_bps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1163 <check_bps+0x53>
cmpl   $0x3,-0x8(%rbp)
je     1163 <check_bps+0x53>
cmpl   $0x2,-0x8(%rbp)
je     1163 <check_bps+0x53>
cmpl   $0x1,-0x8(%rbp)
je     1163 <check_bps+0x53>
mov    -0x8(%rbp),%edx
mov    $0x2501,%edi
lea    0xeae(%rip),%rsi
call   1030 <mp_msg_c@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    116a <check_bps+0x5a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_bps>:
mov    %edi,%edx
lea    -0x5(%rdx),%ecx
mov    $0x1,%eax
cmp    $0xfffffffb,%ecx
ja     113a <check_bps+0x2a>
push   %rax
lea    0xed9(%rip),%rsi
mov    $0x2501,%edi
call   1030 <mp_msg_c@plt>
mov    $0xfffffffe,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [84 x i8] c"[format] The number of bytes per sample must be 1, 2, 3 or 4. Current value is %i \0A\00"
define i32 @check_bps(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 4
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %3
%17 = call i32 @mp_msg_c(i32 9473, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32 -2, i32* %2
br label %19
18: ; preds = %12, %9, %6, %1
store i32 1, i32* %2
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [84 x i8] c"[format] The number of bytes per sample must be 1, 2, 3 or 4. Current value is %i \0A\00"
define i32 @check_bps(i32 %0) {
%2 = add i32 %0, -5
%3 = icmp ult i32 %2, -4
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @mp_msg_c(i32 9473, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -2, %4 ], [ 1, %1 ]
ret i32 %7
}
/* Type definitions */
struct sf_dfa {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ stdin;
struct sf_dfa *string_file_dfa_new(int /*<<< orphan*/, char *);
int /*<<< orphan*/ string_file_dfa_process(struct sf_dfa *);
int main(int argc, char *argv[]) {
  struct sf_dfa *f = string_file_dfa_new(stdin, "aa");
  string_file_dfa_process(f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1040 <string_file_dfa_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <string_file_dfa_process@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <string_file_dfa_new@plt>
mov    %rax,%rdi
call   1030 <string_file_dfa_process@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sf_dfa = type { i32 }
@stdin = global i32 0
@.str = [3 x i8] c"aa\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.sf_dfa*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* @stdin
%7 = call %struct.sf_dfa* @string_file_dfa_new(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store %struct.sf_dfa* %7, %struct.sf_dfa** %5
%8 = load %struct.sf_dfa*, %struct.sf_dfa** %5
%9 = call i32 @string_file_dfa_process(%struct.sf_dfa* %8)
ret i32 0
}

LLVM IR (-O2):
%struct.sf_dfa = type { i32 }
@stdin = global i32 0
@.str = [3 x i8] c"aa\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdin
%4 = tail call %struct.sf_dfa* @string_file_dfa_new(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @string_file_dfa_process(%struct.sf_dfa* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pA(char *, ...);
int /*<<< orphan*/ write_mem(char *, char *);
void push_stackframe(const char *register_name) {
  write_mem("stack_frame", "stack_frame_stack_head");
  pA("stack_frame_stack_head++;");
  pA("stack_frame = %s;", register_name);
}


x86 assembly (clang, -O0):
<push_stackframe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1040 <write_mem@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
mov    -0x8(%rbp),%rsi
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <pA@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_stackframe>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1040 <write_mem@plt>
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <pA@plt>
lea    0xef1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <pA@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"stack_frame\00"
@.str.1 = [23 x i8] c"stack_frame_stack_head\00"
@.str.2 = [26 x i8] c"stack_frame_stack_head++;\00"
@.str.3 = [18 x i8] c"stack_frame = %s;\00"
define void @push_stackframe(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @write_mem(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"stack_frame\00"
@.str.1 = [23 x i8] c"stack_frame_stack_head\00"
@.str.2 = [26 x i8] c"stack_frame_stack_head++;\00"
@.str.3 = [18 x i8] c"stack_frame = %s;\00"
define void @push_stackframe(i8* %0) {
%2 = tail call i32 @write_mem(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @pA(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void d1_freemem(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<d1_freemem>:
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):
<d1_freemem>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @d1_freemem(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 @d1_freemem(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_CLR_INC_PIN() { clear_io_bit(0x34, 2); }


x86 assembly (clang, -O0):
<TOSH_CLR_INC_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x34,%edi
mov    $0x2,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_INC_PIN>:
mov    $0x34,%edi
mov    $0x2,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_INC_PIN() {
%1 = call i32 @clear_io_bit(i32 52, i32 2)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_INC_PIN() {
%1 = tail call i32 @clear_io_bit(i32 52, i32 2)
ret void
}
void syscall_thunk(void) { asm("syscall; thunk_ip:"); }


x86 assembly (clang, -O0):
<syscall_thunk>:
push   %rbp
mov    %rsp,%rbp
syscall

x86 assembly (clang, -O2):
<syscall_thunk>:
syscall

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

LLVM IR (-O2):
define void @syscall_thunk() {
tail call void asm sideeffect "syscall; thunk_ip:", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int security_inode_link(struct dentry *old_dentry, struct inode *dir,
                        struct dentry *new_dentry) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.dentry = type opaque
define i32 @security_inode_link(%struct.dentry* %0, %struct.inode* %1, %struct.dentry* %2) {
%4 = alloca %struct.dentry*
%5 = alloca %struct.inode*
%6 = alloca %struct.dentry*
store %struct.dentry* %0, %struct.dentry** %4
store %struct.inode* %1, %struct.inode** %5
store %struct.dentry* %2, %struct.dentry** %6
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.dentry = type opaque
define i32 @security_inode_link(%struct.dentry* nocapture readnone %0, %struct.inode* nocapture readnone %1, %struct.dentry* nocapture readnone %2) {
ret i32 0
}
int __attribute__((no)) helper_func2(int arg) { return arg > 5; }


x86 assembly (clang, -O0):
<helper_func2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<helper_func2>:
xor    %eax,%eax
cmp    $0x6,%edi
setge  %al
ret

LLVM IR (-O0):
define i32 @helper_func2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 5
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @helper_func2(i32 %0) {
%2 = icmp sgt i32 %0, 5
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("first push\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"first push\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_6Bint64_midword_reg(long long val) {
  return ((val >> 16) & (0x6B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Bint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x6b,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_6Bint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 107
%6 = icmp ne i64 %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_6Bint64_midword_reg(i64 %0) {
%2 = and i64 %0, 7012352
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
float nV(float f) { return f; }


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

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

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

LLVM IR (-O2):
define float @nV(float returned %0) {
ret float %0
}
void vcopy(double *copy, double *v) {
  copy[0] = v[0];
  copy[1] = v[1];
  copy[2] = v[2];
}


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

x86 assembly (clang, -O2):
<vcopy>:
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @vcopy(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %3
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 2
store double %17, double* %19
ret void
}

LLVM IR (-O2):
define void @vcopy(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
store double %3, double* %0
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 1
store double %5, double* %6
%7 = getelementptr inbounds double, double* %1, i64 2
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 2
store double %8, double* %9
ret void
}
int ftgeti4(entry, kw)
char *entry;
struct Keyword *kw;
{
  char temp[30];
  if (ftgetc(entry, kw, temp, 30))
    return ((int)atof(temp));
  else
    return (0);
}


x86 assembly (clang, -O0):
<ftgeti4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x1e,%ecx
mov    $0x0,%al
call   1040 <ftgetc@plt>
cmp    $0x0,%eax
je     1164 <ftgeti4+0x44>
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1030 <atof@plt>
mov    %eax,-0x4(%rbp)
jmp    116b <ftgeti4+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftgeti4>:
push   %rbx
sub    $0x20,%rsp
xor    %ebx,%ebx
mov    %rsp,%rdx
mov    $0x1e,%ecx
xor    %eax,%eax
call   1040 <ftgetc@plt>
test   %eax,%eax
je     1146 <ftgeti4+0x26>
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <atof@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Keyword = type opaque
define i32 @ftgeti4(i8* %0, %struct.Keyword* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.Keyword*
%6 = alloca [30 x i8]
store i8* %0, i8** %4
store %struct.Keyword* %1, %struct.Keyword** %5
%7 = load i8*, i8** %4
%8 = load %struct.Keyword*, %struct.Keyword** %5
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, %struct.Keyword*, i8*, i32, ...) bitcast (i32 (...)* @ftgetc to i32 (i8*, %struct.Keyword*, i8*, i32, ...)*)(i8* %7, %struct.Keyword* %8, i8* %9, i32 30)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %13)
store i32 %14, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.Keyword = type opaque
define i32 @ftgeti4(i8* %0, %struct.Keyword* %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, %struct.Keyword*, i8*, i32, ...) bitcast (i32 (...)* @ftgetc to i32 (i8*, %struct.Keyword*, i8*, i32, ...)*)(i8* %0, %struct.Keyword* %1, i8* %4, i32 30)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %4)
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
void reload() { syslog(LOG_INFO, "RELOAD CONFIG FILE"); }


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

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

LLVM IR (-O0):
@LOG_INFO = global i32 0
@.str = [19 x i8] c"RELOAD CONFIG FILE\00"
define void @reload() {
%1 = load i32, i32* @LOG_INFO
%2 = call i32 @syslog(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@LOG_INFO = global i32 0
@.str = [19 x i8] c"RELOAD CONFIG FILE\00"
define void @reload() {
%1 = load i32, i32* @LOG_INFO
%2 = tail call i32 @syslog(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}
void sysfs_remove_bin_file(struct kobject *kobj,
                           const struct bin_attribute *attr) {}


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

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

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

LLVM IR (-O2):
%struct.kobject = type opaque
%struct.bin_attribute = type opaque
define void @sysfs_remove_bin_file(%struct.kobject* nocapture %0, %struct.bin_attribute* nocapture %1) {
ret void
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
struct __uportsys_sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int __uportsys_connect(int, struct __uportsys_sockaddr const *,
                       int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int connect(int sd, const struct sockaddr *addr, socklen_t addr_len) {
  return __uportsys_connect(sd, (const struct __uportsys_sockaddr *)addr,
                            addr_len, &errno);
}


x86 assembly (clang, -O0):
<connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    0x2ead(%rip),%rcx
call   1030 <__uportsys_connect@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<connect>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <__uportsys_connect@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.__uportsys_sockaddr = type { i32 }
@errno = global i32 0
define i32 @connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = bitcast %struct.sockaddr* %8 to %struct.__uportsys_sockaddr*
%10 = load i32, i32* %6
%11 = call i32 @__uportsys_connect(i32 %7, %struct.__uportsys_sockaddr* %9, i32 %10, i32* @errno)
ret i32 %11
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.__uportsys_sockaddr = type { i32 }
@errno = global i32 0
define i32 @connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = bitcast %struct.sockaddr* %1 to %struct.__uportsys_sockaddr*
%5 = tail call i32 @__uportsys_connect(i32 %0, %struct.__uportsys_sockaddr* %4, i32 %2, i32* @errno)
ret i32 %5
}
int test_imm_87int16_reg(short val) {
  return ((val) & (-0x87 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_87int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -135
%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_87int16_reg(i16 signext %0) {
%2 = and i16 %0, -135
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ cbf(char *);
int /*<<< orphan*/ warning();
int main(int argc, char *argv[]) {
  if (argc != 2) {
    warning();
  } else if (argc == 2) {
    cbf(argv[1]);
  }
  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)
cmpl   $0x2,-0x8(%rbp)
je     114c <main+0x2c>
mov    $0x0,%al
call   1030 <warning@plt>
jmp    1168 <main+0x48>
cmpl   $0x2,-0x8(%rbp)
jne    1163 <main+0x43>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <cbf@plt>
jmp    1168 <main+0x48>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1131 <main+0x11>
mov    0x8(%rsi),%rdi
call   1040 <cbf@plt>
jmp    1138 <main+0x18>
xor    %eax,%eax
call   1030 <warning@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 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @warning()
br label %19
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @cbf(i8* %16)
br label %18
18: ; preds = %13, %10
br label %19
19: ; preds = %18, %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @warning()
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @cbf(i8* %8)
br label %10
10: ; preds = %6, %4
ret i32 0
}
/* Type definitions */
struct timespec {
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
unsigned long long timespec_to_usecs(struct timespec *);
unsigned long long get_cpu_usecs(void) {
  struct timespec ts = {0, 0};
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return timespec_to_usecs(&ts);
}


x86 assembly (clang, -O0):
<get_cpu_usecs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
lea    -0x8(%rbp),%rdi
call   1050 <timespec_to_usecs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cpu_usecs>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <clock_gettime@plt>
mov    %rbx,%rdi
call   1040 <timespec_to_usecs@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @get_cpu_usecs() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = call i64 @timespec_to_usecs(%struct.timespec* %1)
ret i64 %5
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @get_cpu_usecs() {
%1 = alloca i64
%2 = bitcast i64* %1 to %struct.timespec*
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = load i32, i32* @CLOCK_MONOTONIC
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %2)
%6 = call i64 @timespec_to_usecs(%struct.timespec* %2)
ret i64 %6
}
void ALTURA_TIMER_FCN(void const *argument) {}


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

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

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

LLVM IR (-O2):
define void @ALTURA_TIMER_FCN(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int checkcmp();
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ unlink(char *);
int checkresolve() {
  int rc;
  unlink("tools/.chk");
  system("gcc tools/chkresolv.c -o tools/chkresolv -lresolv"
         " 2>tools/.chk ");
  return checkcmp();
}


x86 assembly (clang, -O0):
<checkresolve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec0(%rip),%rdi
call   1050 <system@plt>
mov    $0x0,%al
call   1040 <checkcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkresolve>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <unlink@plt>
lea    0xec7(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <checkcmp@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"tools/.chk\00"
@.str.1 = [64 x i8] c"gcc tools/chkresolv.c -o tools/chkresolv -lresolv 2>tools/.chk \00"
define i32 @checkresolve() {
%1 = alloca i32
%2 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @checkcmp()
ret i32 %4
}

LLVM IR (-O2):
@.str = [11 x i8] c"tools/.chk\00"
@.str.1 = [64 x i8] c"gcc tools/chkresolv.c -o tools/chkresolv -lresolv 2>tools/.chk \00"
define i32 @checkresolve() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @checkcmp()
ret i32 %3
}
float megab(int i) { return ((float)i) / (1024.0 * 1024.0); }


x86 assembly (clang, -O0):
<megab>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<megab>:
cvtsi2ss %edi,%xmm0
mulss  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define float @megab(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
%5 = fpext float %4 to double
%6 = fdiv double %5, 0x4130000000000000
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @megab(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = fmul float %2, 0x3EB0000000000000
ret float %3
}
void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,
                              struct batadv_orig_node *orig_node,
                              struct batadv_orig_node *orig_neigh_node,
                              struct batadv_ogm_packet *ogm_packet,
                              int is_single_hop_neigh) {
  return;
}


x86 assembly (clang, -O0):
<batadv_nc_update_nc_node>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.batadv_priv = type opaque
%struct.batadv_orig_node = type opaque
%struct.batadv_ogm_packet = type opaque
define void @batadv_nc_update_nc_node(%struct.batadv_priv* %0, %struct.batadv_orig_node* %1, %struct.batadv_orig_node* %2, %struct.batadv_ogm_packet* %3, i32 %4) {
%6 = alloca %struct.batadv_priv*
%7 = alloca %struct.batadv_orig_node*
%8 = alloca %struct.batadv_orig_node*
%9 = alloca %struct.batadv_ogm_packet*
%10 = alloca i32
store %struct.batadv_priv* %0, %struct.batadv_priv** %6
store %struct.batadv_orig_node* %1, %struct.batadv_orig_node** %7
store %struct.batadv_orig_node* %2, %struct.batadv_orig_node** %8
store %struct.batadv_ogm_packet* %3, %struct.batadv_ogm_packet** %9
store i32 %4, i32* %10
ret void
}

LLVM IR (-O2):
%struct.batadv_priv = type opaque
%struct.batadv_orig_node = type opaque
%struct.batadv_ogm_packet = type opaque
define void @batadv_nc_update_nc_node(%struct.batadv_priv* nocapture %0, %struct.batadv_orig_node* nocapture %1, %struct.batadv_orig_node* nocapture %2, %struct.batadv_ogm_packet* nocapture %3, i32 %4) {
ret void
}