xunge/DecIR huggingface dataset:
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
double tvdouble(const struct timeval a) {
  return a.tv_sec + a.tv_usec / 1000000.0;
}


x86 assembly (clang, -O0):
<tvdouble>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tvdouble>:
divsd  0xef8(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @tvdouble(double %0, double %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to { double, double }*
%5 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
store double %1, double* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%10 = load double, double* %9
%11 = fdiv double %10, 1.000000e+06
%12 = fadd double %8, %11
ret double %12
}

LLVM IR (-O2):
define double @tvdouble(double %0, double %1) {
%3 = fdiv double %1, 1.000000e+06
%4 = fadd double %3, %0
ret double %4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t align(uint64_t val) {
  if (val & 0xFFF) {
    val &= ~0xFFF;
    val += 0x1000;
  }
  return val;
}


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfff,%eax
cmp    $0x0,%eax
je     112e <align+0x2e>
mov    -0x4(%rbp),%eax
and    $0xfffff000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
lea    0x1000(%rdi),%eax
and    $0xfffff000,%eax
test   $0xfff,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @align(i32 %0) {
%2 = and i32 %0, 4095
%3 = icmp eq i32 %2, 0
%4 = add i32 %0, 4096
%5 = and i32 %4, -4096
%6 = select i1 %3, i32 %0, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ data_to_address(int);
int /*<<< orphan*/ free(char *);
char *read_address(int);
int /*<<< orphan*/ strtok(char *, char *);
void read_all(void) {
  char *line;
  int ctr;
  ctr = 1;
  while ((line = read_address(ctr)) != NULL) {
    strtok(line, "\n");
    ;
    data_to_address(ctr);
    ctr++;
  }
  free(line);
}


x86 assembly (clang, -O0):
<read_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <read_address@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     118b <read_all+0x4b>
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <strtok@plt>
mov    -0xc(%rbp),%edi
call   1060 <data_to_address@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <read_all+0xf>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_all>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <read_address@plt>
test   %rax,%rax
je     1181 <read_all+0x41>
lea    0xea1(%rip),%r14
nop
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strtok@plt>
mov    %ebx,%edi
call   1060 <data_to_address@plt>
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <read_address@plt>
test   %rax,%rax
jne    1160 <read_all+0x20>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @read_all() {
%1 = alloca i8*
%2 = alloca i32
store i32 1, i32* %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
%5 = call i8* @read_address(i32 %4)
store i8* %5, i8** %1
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = load i8*, i8** %1
%9 = call i32 @strtok(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = call i32 @data_to_address(i32 %10)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
%15 = load i8*, i8** %1
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @read_all() {
%1 = tail call i8* @read_address(i32 1)
%2 = icmp eq i8* %1, null
br i1 %2, label %11, label %3
3: ; preds = %0, %3
%4 = phi i8* [ %9, %3 ], [ %1, %0 ]
%5 = phi i32 [ %8, %3 ], [ 1, %0 ]
%6 = tail call i32 @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @data_to_address(i32 %5)
%8 = add nuw nsw i32 %5, 1
%9 = tail call i8* @read_address(i32 %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %3
11: ; preds = %3, %0
%12 = tail call i32 @free(i8* null)
ret void
}
/* Variables and functions */
scalar_t__ isalpha(char);
char toupper(char);
char *strlwr(char *s) {
  char *p;
  for (p = s; *p; p++) {
    if (isalpha(*p))
      *p = toupper(*p);
  }
  return s;
}


x86 assembly (clang, -O0):
<strlwr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1181 <strlwr+0x61>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     116b <strlwr+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1170 <strlwr+0x50>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <strlwr+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlwr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1165 <strlwr+0x45>
mov    %r14,%rbx
jmp    114c <strlwr+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1165 <strlwr+0x45>
movsbl %al,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
je     1140 <strlwr+0x20>
movsbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
jmp    1140 <strlwr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strlwr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = tail call i64 @isalpha(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i8, i8* %6
%11 = tail call signext i8 @toupper(i8 signext %10)
store i8 %11, i8* %6
br label %12
12: ; preds = %4, %9
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %1
ret i8* %0
}
int match(const void *k1, const void *k2) { return *(int *)k1 == *(int *)k2; }


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @match(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @match(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_number(size_t len, unsigned char *data) {
  for (size_t i = 0; i < len; i++) {
    printf("%02X ", data[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1161 <print_number+0x51>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <print_number+0x18>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_number>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1158 <print_number+0x38>
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_number+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%02X \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_number(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
store i64 %0, i64* %3
store i8* %1, i8** %4
store i64 0, i64* %5
br label %6
6: ; preds = %17, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %3
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i64, i64* %5
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i64, i64* %5
%19 = add i64 %18, 1
store i64 %19, i64* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%02X \00"
define void @print_number(i64 %0, i8* nocapture %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %2
%5 = tail call i32 @putchar(i32 10)
ret void
6: ; preds = %2, %6
%7 = phi i64 [ %12, %6 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw i64 %7, 1
%13 = icmp eq i64 %12, %0
br i1 %13, label %4, label %6
}
void set_pid_gains(int motor, int p, int i, int d, int pd, int id, int dd) {}


x86 assembly (clang, -O0):
<set_pid_gains>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @set_pid_gains(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = 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
store i32 %6, i32* %14
ret void
}

LLVM IR (-O2):
define void @set_pid_gains(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ display_imm(char *);
void display_fini(void) {
  display_imm("\033[r"
              "\033["
              "500"
              "B");
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"\1B[r\1B[500B\00"
define void @display_fini() {
%1 = call i32 @display_imm(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"\1B[r\1B[500B\00"
define void @display_fini() {
%1 = tail call i32 @display_imm(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ andagain();
int /*<<< orphan*/ anotherFunction();
int /*<<< orphan*/ multiplyfive();
int /*<<< orphan*/ myFunction();
int /*<<< orphan*/ stillmore();
int main(void) {
  myFunction();
  anotherFunction();
  stillmore();
  andagain();
  multiplyfive();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <myFunction@plt>
mov    $0x0,%al
call   1040 <anotherFunction@plt>
mov    $0x0,%al
call   1070 <stillmore@plt>
mov    $0x0,%al
call   1060 <andagain@plt>
mov    $0x0,%al
call   1030 <multiplyfive@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <myFunction@plt>
xor    %eax,%eax
call   1040 <anotherFunction@plt>
xor    %eax,%eax
call   1070 <stillmore@plt>
xor    %eax,%eax
call   1060 <andagain@plt>
xor    %eax,%eax
call   1030 <multiplyfive@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @myFunction()
%3 = call i32 (...) @anotherFunction()
%4 = call i32 (...) @stillmore()
%5 = call i32 (...) @andagain()
%6 = call i32 (...) @multiplyfive()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @myFunction()
%2 = tail call i32 (...) @anotherFunction()
%3 = tail call i32 (...) @stillmore()
%4 = tail call i32 (...) @andagain()
%5 = tail call i32 (...) @multiplyfive()
ret i32 0
}
void ff_hevc_put_hevc_bi_w_qpel_hv4_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_qpel_hv4_12_sse4() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void initDlgFunction(FILE *dst, const char *dlgName) {
  fprintf(dst, "\n\n");
  fprintf(dst,
          "static HWND create_dlg_%s \n\t(\n\tHINSTANCE hInst, HWND hParent, "
          "HWND *hFocus\n\t)\n",
          dlgName);
  fprintf(dst, "{\n");
}


x86 assembly (clang, -O0):
<initDlgFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeff(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initDlgFunction>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xef4(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [79 x i8] c"static HWND create_dlg_%s \0A\09(\0A\09HINSTANCE hInst, HWND hParent, HWND *hFocus\0A\09)\0A\00"
@.str.2 = [3 x i8] c"{\0A\00"
define void @initDlgFunction(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = load i8*, i8** %4
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i32*, i32** %3
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [79 x i8] c"static HWND create_dlg_%s \0A\09(\0A\09HINSTANCE hInst, HWND hParent, HWND *hFocus\0A\09)\0A\00"
@.str.2 = [3 x i8] c"{\0A\00"
define void @initDlgFunction(i32* nocapture %0, i8* %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TIOCMGET;
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
int get_serial_lines(int fd) {
  int modem_lines;
  ioctl(fd, TIOCMGET, &modem_lines);
  return modem_lines;
}


x86 assembly (clang, -O0):
<get_serial_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1030 <ioctl@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_serial_lines>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@TIOCMGET = global i32 0
define i32 @get_serial_lines(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @TIOCMGET
%6 = call i32 @ioctl(i32 %4, i32 %5, i32* %3)
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
@TIOCMGET = global i32 0
define i32 @get_serial_lines(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @TIOCMGET
%5 = call i32 @ioctl(i32 %0, i32 %4, i32* %2)
%6 = load i32, i32* %2
ret i32 %6
}
int test_imm_A9int64_lowword_reg(long long val) {
  return ((val) & (0xA9 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A9int64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 169
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_A9int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 169
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void gtk_list_store_swap() {}


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

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

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

LLVM IR (-O2):
define void @gtk_list_store_swap() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *, size_t const);
size_t oui_append_nb(unsigned char *cp, const unsigned char *data,
                     const size_t nlen) {
  memcpy(cp, data, nlen);
  return nlen;
}


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

x86 assembly (clang, -O2):
<oui_append_nb>:
push   %rbx
mov    %rdx,%rbx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @oui_append_nb(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcpy(i8* %7, i8* %8, i64 %9)
%11 = load i64, i64* %6
ret i64 %11
}

LLVM IR (-O2):
define i64 @oui_append_nb(i8* %0, i8* %1, i64 returned %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
ret i64 %2
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("incorrectly formatted metadata\n");
  return EXIT_SUCCESS;
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"incorrectly formatted metadata\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [31 x i8] c"incorrectly formatted metadata\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
int fib(int n, int *ptr) {
  *ptr = *ptr + 1;
  if (n == 1) {
    return 1;
  }
  if (n == 0) {
    return 0;
  }
  return fib(n - 1, ptr) + fib(n - 2, ptr);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x1,-0x8(%rbp)
jne    1144 <fib+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1185 <fib+0x75>
cmpl   $0x0,-0x8(%rbp)
jne    115a <fib+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1185 <fib+0x75>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fib@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
addl   $0x1,(%r14)
cmp    $0x2,%ebx
jb     113b <fib+0x2b>
lea    -0x1(%rbx),%edi
mov    %r14,%rsi
call   1030 <fib@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
jmp    1120 <fib+0x10>
add    %ebp,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0, i32* %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i32 [ 0, %2 ], [ %13, %9 ]
%5 = phi i32 [ %0, %2 ], [ %12, %9 ]
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
%8 = icmp ult i32 %5, 2
br i1 %8, label %14, label %9
9: ; preds = %3
%10 = add nsw i32 %5, -1
%11 = tail call i32 @fib(i32 %10, i32* %1)
%12 = add nsw i32 %5, -2
%13 = add nsw i32 %11, %4
br label %3
14: ; preds = %3
%15 = add nsw i32 %5, %4
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
void antohs(uint16_t *t, int len) {
  int pos = len - 1;
  while (pos >= 0) {
    t[pos] = ntohs(t[pos]);
    pos--;
  }
}


x86 assembly (clang, -O0):
<antohs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     115d <antohs+0x4d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <ntohs@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1128 <antohs+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<antohs>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114b <antohs+0x3b>
mov    %rdi,%r14
mov    %esi,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x2(%rbx),%r15d
mov    (%r14,%r15,4),%edi
call   1030 <ntohs@plt>
mov    %eax,(%r14,%r15,4)
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1130 <antohs+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @antohs(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* %4
%7 = sub nsw i32 %6, 1
store i32 %7, i32* %5
br label %8
8: ; preds = %11, %2
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @ntohs(i32 %16)
%18 = load i32*, i32** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %5
%23 = add nsw i32 %22, -1
store i32 %23, i32* %5
br label %8
24: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @antohs(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add nsw i64 %7, -1
%9 = and i64 %8, 4294967295
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 @ntohs(i32 %11)
store i32 %12, i32* %10
%13 = icmp ugt i64 %7, 1
br i1 %13, label %6, label %14
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
double log(int);
double log2(double a) { return log(a) / log(2); }


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @log(i32 %4)
%6 = call double @log(i32 2)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @log2(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = tail call double @log(i32 2)
%5 = fdiv double %3, %4
ret double %5
}
void SYS_sleep(unsigned long ms) {}


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

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

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

LLVM IR (-O2):
define void @SYS_sleep(i64 %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int rx_timeout(int *, int, int);
int getAck(int *status, int timeout) {
  uint8_t mybuf[2];
  int rc = rx_timeout(mybuf, 1, timeout);
  if (status)
    *status = rc <= 0 ? 0 : 1;
  return *mybuf & 1;
}


x86 assembly (clang, -O0):
<getAck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x1,%esi
call   1030 <rx_timeout@plt>
mov    %eax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <getAck+0x44>
mov    -0x18(%rbp),%edx
mov    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%edx
cmovle %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getAck>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
mov    $0x1,%esi
call   1030 <rx_timeout@plt>
test   %rbx,%rbx
je     1137 <getAck+0x27>
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
mov    %ecx,(%rbx)
mov    0x8(%rsp),%eax
and    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getAck(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @rx_timeout(i32* %7, i32 1, i32 %8)
store i32 %9, i32* %6
%10 = load i32*, i32** %3
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* %6
%14 = icmp sle i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 0, i32 1
%17 = load i32*, i32** %3
store i32 %16, i32* %17
br label %18
18: ; preds = %12, %2
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%20 = load i32, i32* %19
%21 = and i32 %20, 1
ret i32 %21
}

LLVM IR (-O2):
define i32 @getAck(i32* writeonly %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%6 = call i32 @rx_timeout(i32* %5, i32 1, i32 %1)
%7 = icmp eq i32* %0, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = icmp sgt i32 %6, 0
%10 = zext i1 %9 to i32
store i32 %10, i32* %0
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %5
%13 = and i32 %12, 1
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int file_exists(char *path) {
  FILE *Fp;
  Fp = fopen(path, "r");
  if (Fp == NULL)
    return 0;
  fclose(Fp);
  return 1;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <file_exists+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1167 <file_exists+0x47>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <file_exists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @file_exists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
int test_imm_9Euint16_mem(unsigned short *val) {
  return ((*val) & (0x9E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_9Euint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 158
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_9Euint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 158
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ COLOR_MAGENTA;
int /*<<< orphan*/ ChangeColor(int /*<<< orphan*/);
void SetColorMagenta() { ChangeColor(COLOR_MAGENTA); }


x86 assembly (clang, -O0):
<SetColorMagenta>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <ChangeColor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetColorMagenta>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <ChangeColor@plt>

LLVM IR (-O0):
@COLOR_MAGENTA = global i32 0
define void @SetColorMagenta() {
%1 = load i32, i32* @COLOR_MAGENTA
%2 = call i32 @ChangeColor(i32 %1)
ret void
}

LLVM IR (-O2):
@COLOR_MAGENTA = global i32 0
define void @SetColorMagenta() {
%1 = load i32, i32* @COLOR_MAGENTA
%2 = tail call i32 @ChangeColor(i32 %1)
ret void
}
char *f5(char *s) {
  s[0] = '-';
  return s;
}


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

x86 assembly (clang, -O2):
<f5>:
mov    %rdi,%rax
movb   $0x2d,(%rdi)
ret

LLVM IR (-O0):
define i8* @f5(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 45, i8* %4
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @f5(i8* returned writeonly %0) {
store i8 45, i8* %0
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ testDecode();
int main(int argc, char **argv) {
  printf("Running tests...\n");
  testDecode();
  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)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <testDecode@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"Running tests...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @testDecode()
ret i32 0
}

LLVM IR (-O2):
@str = [17 x i8] c"Running tests...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @testDecode()
ret i32 0
}
void bar(int cond) {
  int x, y, *ptr;
  ptr = cond > 0 ? &x : &y;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111e <bar+0x1e>
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    112b <bar+0x2b>
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    112b <bar+0x2b>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %8
%11 = phi i32* [ %3, %8 ], [ %4, %9 ]
store i32* %11, i32** %5
ret void
}

LLVM IR (-O2):
define void @bar(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int);
void cgstack(int n) { ngen("%s\t$%d,%%rsp", "addq", n); }


x86 assembly (clang, -O0):
<cgstack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1030 <ngen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgstack>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xeed(%rip),%rsi
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%s\09$%d,%%rsp\00"
@.str.1 = [5 x i8] c"addq\00"
define void @cgstack(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ngen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s\09$%d,%%rsp\00"
@.str.1 = [5 x i8] c"addq\00"
define void @cgstack(i32 %0) {
%2 = tail call i32 @ngen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PinConfigSet(unsigned long, int, int);
int /*<<< orphan*/ PinModeSet(unsigned long, unsigned long);
void PinTypeI2S(unsigned long ulPin, unsigned long ulPinMode) {
  PinModeSet(ulPin, ulPinMode);
  PinConfigSet(ulPin, 0x00000020 | 0x00000040, 0x00000000);
}


x86 assembly (clang, -O0):
<PinTypeI2S>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <PinModeSet@plt>
mov    -0x8(%rbp),%rdi
mov    $0x60,%esi
xor    %edx,%edx
call   1040 <PinConfigSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PinTypeI2S>:
push   %rbx
mov    %rdi,%rbx
call   1030 <PinModeSet@plt>
mov    %rbx,%rdi
mov    $0x60,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <PinConfigSet@plt>

LLVM IR (-O0):
define void @PinTypeI2S(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i32 @PinModeSet(i64 %5, i64 %6)
%8 = load i64, i64* %3
%9 = call i32 @PinConfigSet(i64 %8, i32 96, i32 0)
ret void
}

LLVM IR (-O2):
define void @PinTypeI2S(i64 %0, i64 %1) {
%3 = tail call i32 @PinModeSet(i64 %0, i64 %1)
%4 = tail call i32 @PinConfigSet(i64 %0, i32 96, i32 0)
ret void
}
void FreeFileList(char **list, int n) {
  int i;
  for (i = 0; i < n; i++) {
    if (list[i]) {
      free(list[i]);
      list[i] = 0;
    }
  }
  free(list);
}


x86 assembly (clang, -O0):
<FreeFileList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1179 <FreeFileList+0x69>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1166 <FreeFileList+0x56>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    116b <FreeFileList+0x5b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <FreeFileList+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FreeFileList>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
test   %esi,%esi
jle    1151 <FreeFileList+0x41>
mov    %esi,%r14d
xor    %ebx,%ebx
jmp    1139 <FreeFileList+0x29>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%r14
je     1151 <FreeFileList+0x41>
mov    (%r15,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <FreeFileList+0x20>
call   1030 <free@plt>
movq   $0x0,(%r15,%rbx,8)
jmp    1130 <FreeFileList+0x20>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @FreeFileList(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %12
%7 = phi i64 [ 0, %4 ], [ %13, %12 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %6
tail call void @free(i8* %9)
store i8* null, i8** %8
br label %12
12: ; preds = %6, %11
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %12, %2
%16 = bitcast i8** %0 to i8*
tail call void @free(i8* %16)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t ring_data_avail(uint32_t size, uint32_t head, uint32_t tail) {
  if (head >= tail)
    return head - tail;
  else
    return size + head - tail;
}


x86 assembly (clang, -O0):
<ring_data_avail>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jl     112f <ring_data_avail+0x2f>
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    113f <ring_data_avail+0x3f>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ring_data_avail>:
xor    %eax,%eax
sub    %rdx,%rsi
cmovl  %rdi,%rax
add    %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @ring_data_avail(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %1, %2
%5 = select i1 %4, i64 %0, i64 0
%6 = sub i64 %1, %2
%7 = add i64 %6, %5
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i = 31, j = 1;
  int numer = 1, denom = 1;
  for (j = 1; j < i; j++)
    denom = denom * j;
  for (i = 31; i <= 60; i++)
    numer = numer * i;
  printf("%d        %d", numer, denom);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1166 <main+0x56>
mov    -0x14(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <main+0x32>
movl   $0x1f,-0x8(%rbp)
cmpl   $0x3c,-0x8(%rbp)
jg     118f <main+0x7f>
mov    -0x10(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x5d>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xc0000000,%esi
mov    $0x54000000,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 31, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
store i32 1, i32* %5
store i32 1, i32* %3
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %5
br label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
store i32 31, i32* %2
br label %18
18: ; preds = %25, %17
%19 = load i32, i32* %2
%20 = icmp sle i32 %19, 60
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %2
%24 = mul nsw i32 %22, %23
store i32 %24, i32* %4
br label %25
25: ; preds = %21
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %18
28: ; preds = %18
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30)
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 -1073741824, i32 1409286144)
ret i32 0
}