xunge/DecIR huggingface dataset:
int fun1087() { return 1087; }


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

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

LLVM IR (-O0):
define i32 @fun1087() {
ret i32 1087
}

LLVM IR (-O2):
define i32 @fun1087() {
ret i32 1087
}
const char *s_action_type_name(int action) {
  static const char *table[] = {
      "CONT",
      "FINI",
      "KILL",
  };
  return table[action];
}


x86 assembly (clang, -O0):
<s_action_type_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
lea    0x2f1e(%rip),%rax
mov    (%rax,%rcx,8),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_action_type_name>:
movslq %edi,%rax
lea    0xef6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@s_action_type_name.table = internal global [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0)]
@.str = [5 x i8] c"CONT\00"
@.str.1 = [5 x i8] c"FINI\00"
@.str.2 = [5 x i8] c"KILL\00"
define i8* @s_action_type_name(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* @s_action_type_name.table, i64 0, i64 %4
%6 = load i8*, i8** %5
ret i8* %6
}

LLVM IR (-O2):
@reltable.s_action_type_name = internal unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.s_action_type_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.s_action_type_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.s_action_type_name to i64)) to i32)]
@.str = [5 x i8] c"CONT\00"
@.str.1 = [5 x i8] c"FINI\00"
@.str.2 = [5 x i8] c"KILL\00"
define i8* @s_action_type_name(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl i64 %2, 2
%4 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.s_action_type_name to i8*), i64 %3)
ret i8* %4
}
void INT_Excep_RIIC0_TEI0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_RIIC0_TEI0() {
ret void
}
int addr2sector(void *p) {
  unsigned int addr = (unsigned int)p;
  int sector;
  if (addr & 0xe0000)
    sector = ((addr & 0xe0000) >> 17) + 4;
  else
    sector = ((addr & 0x1f000) >> 14);
  if (addr & 0x100000)
    sector += 12;
  return sector;
}


x86 assembly (clang, -O0):
<addr2sector>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xe0000,%eax
cmp    $0x0,%eax
je     1136 <addr2sector+0x36>
mov    -0xc(%rbp),%eax
and    $0xe0000,%eax
shr    $0x11,%eax
add    $0x4,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <addr2sector+0x44>
mov    -0xc(%rbp),%eax
and    $0x1f000,%eax
shr    $0xe,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x100000,%eax
cmp    $0x0,%eax
je     115e <addr2sector+0x5e>
mov    -0x10(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addr2sector>:
mov    %edi,%eax
and    $0xe0000,%eax
mov    %eax,%ecx
shr    $0x11,%ecx
add    $0x4,%ecx
mov    %edi,%edx
shr    $0xe,%edx
and    $0x7,%edx
test   %eax,%eax
cmovne %ecx,%edx
lea    0xc(%rdx),%eax
test   $0x100000,%edi
cmove  %edx,%eax
ret

LLVM IR (-O0):
define i32 @addr2sector(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i32
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = and i32 %7, 917504
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i32, i32* %3
%12 = and i32 %11, 917504
%13 = lshr i32 %12, 17
%14 = add i32 %13, 4
store i32 %14, i32* %4
br label %19
15: ; preds = %1
%16 = load i32, i32* %3
%17 = and i32 %16, 126976
%18 = lshr i32 %17, 14
store i32 %18, i32* %4
br label %19
19: ; preds = %15, %10
%20 = load i32, i32* %3
%21 = and i32 %20, 1048576
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 12
store i32 %25, i32* %4
br label %26
26: ; preds = %23, %19
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @addr2sector(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 917504
%5 = icmp eq i32 %4, 0
%6 = lshr exact i32 %4, 17
%7 = add nuw nsw i32 %6, 4
%8 = lshr i32 %3, 14
%9 = and i32 %8, 7
%10 = select i1 %5, i32 %9, i32 %7
%11 = and i32 %3, 1048576
%12 = icmp eq i32 %11, 0
%13 = add nuw nsw i32 %10, 12
%14 = select i1 %12, i32 %10, i32 %13
ret i32 %14
}
int digito(char dgt) {
  if (dgt >= '0' && dgt <= '9') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<digito>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1130 <digito+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1130 <digito+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <digito+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digito>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @digito(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @digito(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
int op_mul(int a, int b) { return a * b; }


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

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

LLVM IR (-O0):
define i32 @op_mul(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 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @op_mul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
int bitcount(unsigned x) {
  int b;
  for (b = 0; x != 0; x &= (x - 1))
    b++;
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <bitcount+0x32>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    110e <bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     111c <bitcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
lea    -0x1(%rdi),%ecx
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = add i32 %5, -1
%8 = and i32 %7, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int write(int, unsigned char *, int);
void writeI2cReg(int i2cFileDesc, unsigned char regAddr, unsigned char value) {
  unsigned char buff[2];
  buff[0] = regAddr;
  buff[1] = value;
  int res = write(i2cFileDesc, buff, 2);
  if (res != 2) {
    perror("I2C: Unable to write i2c register.");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<writeI2cReg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %edi,-0x4(%rbp)
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    -0x5(%rbp),%al
mov    %al,-0x8(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x7(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
je     1186 <writeI2cReg+0x56>
lea    0xe89(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeI2cReg>:
push   %rax
mov    %sil,0x6(%rsp)
mov    %dl,0x7(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
jne    1150 <writeI2cReg+0x20>
pop    %rax
ret
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"I2C: Unable to write i2c register.\00"
define void @writeI2cReg(i32 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca [2 x i8]
%8 = alloca i32
store i32 %0, i32* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i8, i8* %6
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 %11, i8* %12
%13 = load i32, i32* %4
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%15 = call i32 @write(i32 %13, i8* %14, i32 2)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %21
18: ; preds = %3
%19 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"I2C: Unable to write i2c register.\00"
define void @writeI2cReg(i32 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
store i8 %1, i8* %5
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %2, i8* %6
%7 = call i32 @write(i32 %0, i8* %5, i32 2)
%8 = icmp eq i32 %7, 2
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delendpath(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ truncfilepath(char *, int /*<<< orphan*/);
void truncfileupper(char *path) {
  delendpath(path);
  truncfilepath(path, 0);
  if (!path[0])
    strcpy(path, "./");
}


x86 assembly (clang, -O0):
<truncfileupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <delendpath@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <truncfilepath@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    116d <truncfileupper+0x3d>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncfileupper>:
push   %rbx
mov    %rdi,%rbx
call   1050 <delendpath@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <truncfilepath@plt>
cmpb   $0x0,(%rbx)
je     114a <truncfileupper+0x1a>
pop    %rbx
ret
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"./\00"
define void @truncfileupper(i8* %0) {
%2 = tail call i32 @delendpath(i8* %0)
%3 = tail call i32 @truncfilepath(i8* %0, i32 0)
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigwait(int /*<<< orphan*/ *, int *);
int idle_thread_fn(void *arg) {
  sigset_t set;
  int sig;
  sigemptyset(&set);
  sigaddset(&set, SIGTERM);
  sigwait(&set, &sig);
  return 0;
}


x86 assembly (clang, -O0):
<idle_thread_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <sigemptyset@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdi
call   1050 <sigaddset@plt>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <sigwait@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idle_thread_fn>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <sigemptyset@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <sigwait@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIGTERM = global i32 0
define i32 @idle_thread_fn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @sigemptyset(i32* %3)
%6 = load i32, i32* @SIGTERM
%7 = call i32 @sigaddset(i32* %3, i32 %6)
%8 = call i32 @sigwait(i32* %3, i32* %4)
ret i32 0
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define i32 @idle_thread_fn(i8* nocapture readnone %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @sigemptyset(i32* %2)
%7 = load i32, i32* @SIGTERM
%8 = call i32 @sigaddset(i32* %2, i32 %7)
%9 = call i32 @sigwait(i32* %2, i32* %3)
ret i32 0
}
/* Type definitions */
typedef int __le16;

/* Variables and functions */
int __cpu_to_le16(int);
int ieee80211_is_nullfunc(__le16 fc) {
  return (fc & __cpu_to_le16(0x000c | 0x00f0)) ==
         __cpu_to_le16(0x0008 | 0x0040);
}


x86 assembly (clang, -O0):
<ieee80211_is_nullfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0xfc,%edi
call   1030 <__cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x48,%edi
call   1030 <__cpu_to_le16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieee80211_is_nullfunc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xfc,%edi
call   1030 <__cpu_to_le16@plt>
mov    %eax,%ebp
and    %ebx,%ebp
mov    $0x48,%edi
call   1030 <__cpu_to_le16@plt>
xor    %ecx,%ecx
cmp    %eax,%ebp
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ieee80211_is_nullfunc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @__cpu_to_le16(i32 252)
%5 = and i32 %3, %4
%6 = call i32 @__cpu_to_le16(i32 72)
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @ieee80211_is_nullfunc(i32 %0) {
%2 = tail call i32 @__cpu_to_le16(i32 252)
%3 = and i32 %2, %0
%4 = tail call i32 @__cpu_to_le16(i32 72)
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int pow(float, int);
float outQuint(float t, float b, float c, float d) {
  return c * (pow(t / d - 1, 5) + 1) + b;
}


x86 assembly (clang, -O0):
<outQuint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  0xeb8(%rip),%xmm1
subss  %xmm1,%xmm0
mov    $0x5,%edi
call   1030 <pow@plt>
movss  -0x14(%rbp),%xmm0
add    $0x1,%eax
cvtsi2ss %eax,%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outQuint>:
push   %rax
movss  %xmm2,(%rsp)
movss  %xmm1,0x4(%rsp)
divss  %xmm3,%xmm0
addss  0xed8(%rip),%xmm0
mov    $0x5,%edi
call   1030 <pow@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @outQuint(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %7
%10 = load float, float* %5
%11 = load float, float* %8
%12 = fdiv float %10, %11
%13 = fsub float %12, 1.000000e+00
%14 = call i32 @pow(float %13, i32 5)
%15 = add nsw i32 %14, 1
%16 = sitofp i32 %15 to float
%17 = load float, float* %6
%18 = call float @llvm.fmuladd.f32(float %9, float %16, float %17)
ret float %18
}

LLVM IR (-O2):
define float @outQuint(float %0, float %1, float %2, float %3) {
%5 = fdiv float %0, %3
%6 = fadd float %5, -1.000000e+00
%7 = tail call i32 @pow(float %6, i32 5)
%8 = add nsw i32 %7, 1
%9 = sitofp i32 %8 to float
%10 = tail call float @llvm.fmuladd.f32(float %2, float %9, float %1)
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
int /*<<< orphan*/ load_wrk_table(int /*<<< orphan*/);
char *long2str(char *, int /*<<< orphan*/);
char *macloadIntTbl(char *arg) {
  return long2str(arg, load_wrk_table(get_string(arg)));
}


x86 assembly (clang, -O0):
<macloadIntTbl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_string@plt>
mov    %eax,%edi
call   1040 <load_wrk_table@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1050 <long2str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macloadIntTbl>:
push   %rbx
mov    %rdi,%rbx
call   1030 <get_string@plt>
mov    %eax,%edi
call   1040 <load_wrk_table@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1050 <long2str@plt>

LLVM IR (-O0):
define i8* @macloadIntTbl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @get_string(i8* %4)
%6 = call i32 @load_wrk_table(i32 %5)
%7 = call i8* @long2str(i8* %3, i32 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @macloadIntTbl(i8* %0) {
%2 = tail call i32 @get_string(i8* %0)
%3 = tail call i32 @load_wrk_table(i32 %2)
%4 = tail call i8* @long2str(i8* %0, i32 %3)
ret i8* %4
}
void gtk_font_button_get_title() {}


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

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

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

LLVM IR (-O2):
define void @gtk_font_button_get_title() {
ret void
}
/* Variables and functions */
scalar_t__ calloc(size_t, int);
char *make_empty_string(void) {
  return ((char *)calloc(((size_t)1), sizeof(char)));
}


x86 assembly (clang, -O0):
<make_empty_string>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @make_empty_string() {
%1 = call i64 @calloc(i64 1, i32 1)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}

LLVM IR (-O2):
define i8* @make_empty_string() {
%1 = tail call i64 @calloc(i64 1, i32 1)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ramget(int *, int /*<<< orphan*/);
void ramget_hybrid(int *val, uint32_t addr) { ramget(val, addr); }


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

x86 assembly (clang, -O2):
<ramget_hybrid>:
jmp    1030 <ramget@plt>

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

LLVM IR (-O2):
define void @ramget_hybrid(i32* %0, i32 %1) {
%3 = tail call i32 @ramget(i32* %0, i32 %1)
ret void
}
/* Variables and functions */
int close(int);
int closefile(int handle) { return close(handle); }


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

x86 assembly (clang, -O2):
<closefile>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @closefile(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int epoll_create1(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int epoll() {
  int epollfd;
  epollfd = epoll_create1(0);
  if (epollfd == -1) {
    do {
      perror("epoll_create");
      exit(1);
    } while (0);
  }
  return epollfd;
}


x86 assembly (clang, -O0):
<epoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <epoll_create1@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1167 <epoll+0x37>
jmp    1151 <epoll+0x21>
lea    0xea8(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epoll>:
push   %rax
xor    %edi,%edi
call   1050 <epoll_create1@plt>
cmp    $0xffffffff,%eax
je     113f <epoll+0xf>
pop    %rcx
ret
lea    0xeba(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"epoll_create\00"
define i32 @epoll() {
%1 = alloca i32
%2 = call i32 @epoll_create1(i32 0)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %0
br label %6
6: ; preds = %5
%7 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; No predecessors!
br label %10
10: ; preds = %9, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [13 x i8] c"epoll_create\00"
define i32 @epoll() {
%1 = tail call i32 @epoll_create1(i32 0)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
ret i32 %1
}
void adis16209_unconfigure_ring(struct iio_dev *indio_dev) {}


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

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

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

LLVM IR (-O2):
%struct.iio_dev = type opaque
define void @adis16209_unconfigure_ring(%struct.iio_dev* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func();
int main(void) {
  func();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @func()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x4f() {
  Assert_real((isodigit(79) == 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_isodigit.c",
              400, ("isodigit should be 0 for O"));
}


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

x86 assembly (clang, -O2):
<t_isodigit_0x4f>:
push   %rax
mov    $0x4f,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x190,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isodigit.c\00"
@.str.1 = [27 x i8] c"isodigit should be 0 for O\00"
define void @t_isodigit_0x4f() {
%1 = call i64 @isodigit(i32 79)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 400, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isodigit.c\00"
@.str.1 = [27 x i8] c"isodigit should be 0 for O\00"
define void @t_isodigit_0x4f() {
%1 = tail call i64 @isodigit(i32 79)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 400, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ xorr_avx512(scalar_t__ *, scalar_t__ const *, size_t);
void maddrc2_avx512(uint8_t *region1, const uint8_t *region2, uint8_t constant,
                    size_t length) {
  if (constant != 0)
    xorr_avx512(region1, region2, length);
}


x86 assembly (clang, -O0):
<maddrc2_avx512>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1144 <maddrc2_avx512+0x34>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <xorr_avx512@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maddrc2_avx512>:
test   %rdx,%rdx
je     111d <maddrc2_avx512+0xd>
mov    %rcx,%rdx
jmp    1030 <xorr_avx512@plt>
ret

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

LLVM IR (-O2):
define void @maddrc2_avx512(i64* %0, i64* %1, i64 %2, i64 %3) {
%5 = icmp eq i64 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @xorr_avx512(i64* %0, i64* %1, i64 %3)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int strlen(char *);
char tolower(char);
char *strtolower(char *s) {
  int j;
  for (j = 0; j < strlen(s); j++)
    s[j] = tolower(s[j]);
  return s;
}


x86 assembly (clang, -O0):
<strtolower>:
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 <strtolower+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 <strtolower+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtolower>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1161 <strtolower+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 <strtolower+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strtolower(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
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
define i8* @strtolower(i8* returned %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 i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
dummy() { printf("This is the dummy function!\n"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"This is the dummy function!\0A\00"
define i32 @dummy() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [28 x i8] c"This is the dummy function!\00"
define i32 @dummy() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
double dqrand();
double const log(double);
double qrand_exponential(double const lambda) {
  double u = dqrand();
  return -log(u) / lambda;
}


x86 assembly (clang, -O0):
<qrand_exponential>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <dqrand@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qrand_exponential>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <dqrand@plt>
call   1040 <log@plt>
xorpd  0xec6(%rip),%xmm0
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @qrand_exponential(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = call double (...) @dqrand()
store double %4, double* %3
%5 = load double, double* %3
%6 = call double @log(double %5)
%7 = fneg double %6
%8 = load double, double* %2
%9 = fdiv double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @qrand_exponential(double %0) {
%2 = tail call double (...) @dqrand()
%3 = tail call double @log(double %2)
%4 = fneg double %3
%5 = fdiv double %4, %0
ret double %5
}
int StreamWriter_GetPosition(struct StreamWriter *self) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.StreamWriter = type opaque
define i32 @StreamWriter_GetPosition(%struct.StreamWriter* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_cancel(int /*<<< orphan*/);
int /*<<< orphan*/ pthread_join(int /*<<< orphan*/, int /*<<< orphan*/ *);
void stop_thread(pthread_t *pth) {
  if (pth) {
    pthread_cancel(*pth);
    pthread_join(*pth, NULL);
    free(pth);
  }
}


x86 assembly (clang, -O0):
<stop_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116a <stop_thread+0x3a>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <pthread_cancel@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_join@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stop_thread>:
test   %rdi,%rdi
je     1152 <stop_thread+0x22>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1050 <pthread_cancel@plt>
mov    (%rbx),%edi
xor    %esi,%esi
call   1040 <pthread_join@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @stop_thread(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = call i32 @pthread_cancel(i32 %7)
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = call i32 @pthread_join(i32 %10, i32* null)
%12 = load i32*, i32** %2
%13 = call i32 @free(i32* %12)
br label %14
14: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @stop_thread(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i32, i32* %0
%5 = tail call i32 @pthread_cancel(i32 %4)
%6 = load i32, i32* %0
%7 = tail call i32 @pthread_join(i32 %6, i32* null)
%8 = tail call i32 @free(i32* %0)
br label %9
9: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __print_float(int /*<<< orphan*/);
int /*<<< orphan*/ __print_int(int);
int /*<<< orphan*/ a();
int /*<<< orphan*/ b(int);
double c();
int /*<<< orphan*/ d(double);
int main() {
  a();
  b(42);
  __print_int(c());
  __print_int(c() + 5);
  __print_float(d(0.5));
  __print_float(d(c()));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <a@plt>
mov    $0x2a,%edi
call   1040 <b@plt>
mov    $0x0,%al
call   1070 <c@plt>
cvttsd2si %xmm0,%edi
call   1060 <__print_int@plt>
mov    $0x0,%al
call   1070 <c@plt>
movsd  0xe69(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <__print_int@plt>
movsd  0xe4c(%rip),%xmm0
call   1030 <d@plt>
mov    %eax,%edi
call   1050 <__print_float@plt>
mov    $0x0,%al
call   1070 <c@plt>
call   1030 <d@plt>
mov    %eax,%edi
call   1050 <__print_float@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <a@plt>
mov    $0x2a,%edi
call   1040 <b@plt>
xor    %eax,%eax
call   1070 <c@plt>
cvttsd2si %xmm0,%edi
call   1060 <__print_int@plt>
xor    %eax,%eax
call   1070 <c@plt>
addsd  0xe6f(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <__print_int@plt>
movsd  0xe66(%rip),%xmm0
call   1030 <d@plt>
mov    %eax,%edi
call   1050 <__print_float@plt>
xor    %eax,%eax
call   1070 <c@plt>
call   1030 <d@plt>
mov    %eax,%edi
call   1050 <__print_float@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @a()
%3 = call i32 @b(i32 42)
%4 = call double (...) @c()
%5 = fptosi double %4 to i32
%6 = call i32 @__print_int(i32 %5)
%7 = call double (...) @c()
%8 = fadd double %7, 5.000000e+00
%9 = fptosi double %8 to i32
%10 = call i32 @__print_int(i32 %9)
%11 = call i32 @d(double 5.000000e-01)
%12 = call i32 @__print_float(i32 %11)
%13 = call double (...) @c()
%14 = call i32 @d(double %13)
%15 = call i32 @__print_float(i32 %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 @b(i32 42)
%3 = tail call double (...) @c()
%4 = fptosi double %3 to i32
%5 = tail call i32 @__print_int(i32 %4)
%6 = tail call double (...) @c()
%7 = fadd double %6, 5.000000e+00
%8 = fptosi double %7 to i32
%9 = tail call i32 @__print_int(i32 %8)
%10 = tail call i32 @d(double 5.000000e-01)
%11 = tail call i32 @__print_float(i32 %10)
%12 = tail call double (...) @c()
%13 = tail call i32 @d(double %12)
%14 = tail call i32 @__print_float(i32 %13)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void minipack_pack_fixarray(void *ptr, uint8_t count, size_t *sz) {
  *sz = 1;
  *((uint8_t *)ptr) = (count & 0x0F) | 0x90;
}


x86 assembly (clang, -O0):
<minipack_pack_fixarray>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x1,(%rax)
mov    -0xc(%rbp),%ecx
and    $0xf,%ecx
or     $0x90,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_pack_fixarray>:
movq   $0x1,(%rdx)
and    $0xf,%esi
or     $0x90,%esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @minipack_pack_fixarray(i8* %0, i32 %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64* %2, i64** %6
%7 = load i64*, i64** %6
store i64 1, i64* %7
%8 = load i32, i32* %5
%9 = and i32 %8, 15
%10 = or i32 %9, 144
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @minipack_pack_fixarray(i8* nocapture writeonly %0, i32 %1, i64* nocapture writeonly %2) {
store i64 1, i64* %2
%4 = and i32 %1, 15
%5 = or i32 %4, 144
%6 = bitcast i8* %0 to i32*
store i32 %5, i32* %6
ret void
}
int GCD(int a, int b) {
  while (a > 0 && b > 0 && (a %= b) && (b %= a))
    ;
  return a + b;
}


x86 assembly (clang, -O0):
<GCD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jle    1157 <GCD+0x57>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jle    1157 <GCD+0x57>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0x9(%rbp)
je     1157 <GCD+0x57>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmp    $0x0,%edx
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1167 <GCD+0x67>
jmp    116c <GCD+0x6c>
jmp    110a <GCD+0xa>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCD>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %edi,%edi
jle    1134 <GCD+0x34>
test   %esi,%esi
jle    1134 <GCD+0x34>
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     1132 <GCD+0x32>
mov    %edx,%edi
mov    %esi,%eax
xor    %edx,%edx
div    %edi
mov    %edx,%esi
test   %edx,%edx
jne    1110 <GCD+0x10>
jmp    1136 <GCD+0x36>
xor    %edi,%edi
mov    %esi,%ecx
add    %ecx,%edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @GCD(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %23, %2
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = srem i32 %13, %12
store i32 %14, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = srem i32 %18, %17
store i32 %19, i32* %4
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %16, %11, %8, %5
%22 = phi i1 [ false, %11 ], [ false, %8 ], [ false, %5 ], [ %20, %16 ]
br i1 %22, label %23, label %24
23: ; preds = %21
br label %5
24: ; preds = %21
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = add nsw i32 %25, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @GCD(i32 %0, i32 %1) {
br label %3
3: ; preds = %12, %2
%4 = phi i32 [ %0, %2 ], [ %10, %12 ]
%5 = phi i32 [ %1, %2 ], [ %13, %12 ]
%6 = icmp sgt i32 %4, 0
%7 = icmp sgt i32 %5, 0
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = urem i32 %4, %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = urem i32 %5, %10
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %3
15: ; preds = %3, %9, %12
%16 = phi i32 [ %10, %12 ], [ 0, %9 ], [ %4, %3 ]
%17 = phi i32 [ 0, %12 ], [ %5, %9 ], [ %5, %3 ]
%18 = add nsw i32 %17, %16
ret i32 %18
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double when(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (double)(tv.tv_sec) + (double)(tv.tv_usec) * (double)(1e-6);
}


x86 assembly (clang, -O0):
<when>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @when() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @when() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
void pid_uninit() { remove("/tmp/wetalk.pid"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"/tmp/wetalk.pid\00"
define void @pid_uninit() {
%1 = call i32 @remove(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"/tmp/wetalk.pid\00"
define void @pid_uninit() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int);
int dangerous_add(int lhs, int rhs) {
  int sum;
  sum = lhs + rhs;
  if (sum == 0)
    exit(1);
  if (sum < 0)
    abort();
  return sum;
}


x86 assembly (clang, -O0):
<dangerous_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114b <dangerous_add+0x2b>
mov    $0x1,%edi
call   1040 <exit@plt>
cmpl   $0x0,-0xc(%rbp)
jge    115c <dangerous_add+0x3c>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dangerous_add>:
push   %rax
add    %esi,%edi
je     112b <dangerous_add+0xb>
js     1135 <dangerous_add+0x15>
mov    %edi,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1040 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @dangerous_add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = icmp slt i32 %3, 0
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %7
ret i32 %3
}
/* Type definitions */
struct archive {
  int dummy;
};

/* Variables and functions */
int archive_read_support_filter_all(struct archive *);
int _alpm_archive_read_support_filter_all(struct archive *archive) {
  return archive_read_support_filter_all(archive);
}


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

x86 assembly (clang, -O2):
<_alpm_archive_read_support_filter_all>:
jmp    1030 <archive_read_support_filter_all@plt>

LLVM IR (-O0):
%struct.archive = type { i32 }
define i32 @_alpm_archive_read_support_filter_all(%struct.archive* %0) {
%2 = alloca %struct.archive*
store %struct.archive* %0, %struct.archive** %2
%3 = load %struct.archive*, %struct.archive** %2
%4 = call i32 @archive_read_support_filter_all(%struct.archive* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.archive = type { i32 }
define i32 @_alpm_archive_read_support_filter_all(%struct.archive* %0) {
%2 = tail call i32 @archive_read_support_filter_all(%struct.archive* %0)
ret i32 %2
}