xunge/DecIR huggingface dataset:
int __attribute__((no)) foo(int x) { return x & 2; }


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

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
and    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = and i32 %0, 2
ret i32 %2
}
void si5338_read_error(int error, const char *s) {
  do {
    do {
    } while (0);
  } while (0);
  return;
}


x86 assembly (clang, -O0):
<si5338_read_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
jmp    1110 <si5338_read_error+0x10>
jmp    1115 <si5338_read_error+0x15>
jmp    111a <si5338_read_error+0x1a>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @si5338_read_error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
br label %5
5: ; preds = %2
br label %6
6: ; preds = %5
br label %7
7: ; preds = %6
br label %8
8: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @si5338_read_error(i32 %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Foo\n");
  return 0;
}


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>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [4 x i8] c"Foo\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_D3uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xD3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D3uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 211
%7 = icmp ne i64 %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_D3uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 906238099456
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void *thread_fcn(void *parameter) {
  int i = 0;
  for (i = 0; i < 5; i++) {
    printf("[thread] >i currently equals %d \n", i);
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<thread_fcn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    116b <thread_fcn+0x4b>
mov    -0xc(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <thread_fcn+0x1a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_fcn>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"[thread] >i currently equals %d \0A\00"
define i8* @thread_fcn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @sleep(i32 1)
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
@.str = [34 x i8] c"[thread] >i currently equals %d \0A\00"
define noalias i8* @thread_fcn(i8* nocapture readnone %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 4)
%11 = tail call i32 @sleep(i32 1)
ret i8* null
}
void gtk_file_chooser_get_preview_widget_active() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_chooser_get_preview_widget_active() {
ret void
}
long GetCacheViewThreadId(void) { return (0); }


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

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

LLVM IR (-O0):
define i64 @GetCacheViewThreadId() {
ret i64 0
}

LLVM IR (-O2):
define i64 @GetCacheViewThreadId() {
ret i64 0
}
int os_net_cleanup(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @os_net_cleanup() {
ret i32 0
}

LLVM IR (-O2):
define i32 @os_net_cleanup() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void pap_report_undefined(const char *func_name) {
  fprintf(stderr, "Pa Proxy: unimplemented function '%s'\n", func_name);
}


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

x86 assembly (clang, -O2):
<pap_report_undefined>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Pa Proxy: unimplemented function '%s'\0A\00"
define void @pap_report_undefined(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Pa Proxy: unimplemented function '%s'\0A\00"
define void @pap_report_undefined(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
double foo(void) { return 0xF1EC7A5239123AF; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @foo() {
ret double 0x43AE3D8F4A472247
}

LLVM IR (-O2):
define double @foo() {
ret double 0x43AE3D8F4A472247
}
/* Variables and functions */
char tolower(char);
char *forceLC(char *str) {
  char *ptr = (char *)NULL;
  for (ptr = str; *ptr != '\0'; ptr++) {
    *ptr = tolower(*ptr);
  }
  return str;
}


x86 assembly (clang, -O0):
<forceLC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1161 <forceLC+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <forceLC+0x1c>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forceLC>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <forceLC+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <forceLC+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @forceLC(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @tolower(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i8* %0
}
void TM11_intr(void) {}


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

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

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

LLVM IR (-O2):
define void @TM11_intr() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int sched_getcpu();
void *runner(void *p) {
  int i = 0;
  while (i < 1000)
    i++;
  printf("Thread %d Finalizada na CPU %d\n", (int)(size_t)p, sched_getcpu());
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<runner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    115e <runner+0x2e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <runner+0x13>
mov    -0x10(%rbp),%rax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <sched_getcpu@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runner>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <sched_getcpu@plt>
lea    0xebe(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Thread %d Finalizada na CPU %d\0A\00"
define i8* @runner(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %8, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 1000
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
store i32 %10, i32* %4
br label %5
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = ptrtoint i8* %12 to i64
%14 = trunc i64 %13 to i32
%15 = call i32 (...) @sched_getcpu()
%16 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%17 = call i32 @pthread_exit(i32* null)
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [32 x i8] c"Thread %d Finalizada na CPU %d\0A\00"
define noalias i8* @runner(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 (...) @sched_getcpu()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double c, f;
  printf("Informe a temperatura em Fahrenheit: ");
  scanf("%lf", &f);
  c = (f - 32) / 18000;
  printf("A temperatura em Celsius é %.2lf\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xeae(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xebf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
addsd  0xeb5(%rip),%xmm0
divsd  0xeb5(%rip),%xmm0
lea    0xee0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Informe a temperatura em Fahrenheit: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [35 x i8] c"A temperatura em Celsius \C3\A9 %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%6 = load double, double* %3
%7 = fsub double %6, 3.200000e+01
%8 = fdiv double %7, 1.800000e+04
store double %8, double* %2
%9 = load double, double* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Informe a temperatura em Fahrenheit: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [35 x i8] c"A temperatura em Celsius \C3\A9 %.2lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fadd double %5, -3.200000e+01
%7 = fdiv double %6, 1.800000e+04
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t udp_get_srcport(const uint8_t *p_udp) {
  return (p_udp[0] << 8) | p_udp[1];
}


x86 assembly (clang, -O0):
<udp_get_srcport>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<udp_get_srcport>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @udp_get_srcport(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @udp_get_srcport(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
char boardColumnToChar(int);
void invalidColumnIndicesConvertedToQuestionMark(void) {
  assert(boardColumnToChar(19) == '?');
  assert(boardColumnToChar(-1) == '?');
}


x86 assembly (clang, -O0):
<invalidColumnIndicesConvertedToQuestionMark>:
push   %rbp
mov    %rsp,%rbp
mov    $0x13,%edi
call   1040 <boardColumnToChar@plt>
movsbl %al,%eax
cmp    $0x3f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%edi
call   1040 <boardColumnToChar@plt>
movsbl %al,%eax
cmp    $0x3f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalidColumnIndicesConvertedToQuestionMark>:
push   %rax
mov    $0x13,%edi
call   1040 <boardColumnToChar@plt>
xor    %edi,%edi
cmp    $0x3f,%al
sete   %dil
call   1030 <assert@plt>
mov    $0xffffffff,%edi
call   1040 <boardColumnToChar@plt>
xor    %edi,%edi
cmp    $0x3f,%al
sete   %dil
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @invalidColumnIndicesConvertedToQuestionMark() {
%1 = call signext i8 @boardColumnToChar(i32 19)
%2 = sext i8 %1 to i32
%3 = icmp eq i32 %2, 63
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call signext i8 @boardColumnToChar(i32 -1)
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 63
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
ret void
}

LLVM IR (-O2):
define void @invalidColumnIndicesConvertedToQuestionMark() {
%1 = tail call signext i8 @boardColumnToChar(i32 19)
%2 = icmp eq i8 %1, 63
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call signext i8 @boardColumnToChar(i32 -1)
%6 = icmp eq i8 %5, 63
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret void
}
/* Type definitions */
typedef size_t uint8_t;

/* Variables and functions */
size_t zigbee_doChecksum(size_t *, int);
void zigbee_appendChecksum(uint8_t *buffer, uint8_t *sizeFrame) {
  buffer[*sizeFrame] =
      zigbee_doChecksum(&buffer[(3)], &buffer[*sizeFrame] - &buffer[(3)]);
  (*sizeFrame)++;
}


x86 assembly (clang, -O0):
<zigbee_appendChecksum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x18,%rdi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
add    $0x18,%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %eax,%esi
call   1030 <zigbee_doChecksum@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zigbee_appendChecksum>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x18,%rdi
mov    (%rsi),%esi
add    $0xfffffffd,%esi
call   1030 <zigbee_doChecksum@plt>
mov    (%rbx),%rcx
mov    %rax,(%r14,%rcx,8)
addq   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @zigbee_appendChecksum(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 = getelementptr inbounds i64, i64* %5, i64 3
%7 = load i64*, i64** %3
%8 = load i64*, i64** %4
%9 = load i64, i64* %8
%10 = getelementptr inbounds i64, i64* %7, i64 %9
%11 = load i64*, i64** %3
%12 = getelementptr inbounds i64, i64* %11, i64 3
%13 = ptrtoint i64* %10 to i64
%14 = ptrtoint i64* %12 to i64
%15 = sub i64 %13, %14
%16 = sdiv exact i64 %15, 8
%17 = trunc i64 %16 to i32
%18 = call i64 @zigbee_doChecksum(i64* %6, i32 %17)
%19 = load i64*, i64** %3
%20 = load i64*, i64** %4
%21 = load i64, i64* %20
%22 = getelementptr inbounds i64, i64* %19, i64 %21
store i64 %18, i64* %22
%23 = load i64*, i64** %4
%24 = load i64, i64* %23
%25 = add i64 %24, 1
store i64 %25, i64* %23
ret void
}

LLVM IR (-O2):
define void @zigbee_appendChecksum(i64* %0, i64* nocapture %1) {
%3 = getelementptr inbounds i64, i64* %0, i64 3
%4 = load i64, i64* %1
%5 = trunc i64 %4 to i32
%6 = add i32 %5, -3
%7 = tail call i64 @zigbee_doChecksum(i64* %3, i32 %6)
%8 = load i64, i64* %1
%9 = getelementptr inbounds i64, i64* %0, i64 %8
store i64 %7, i64* %9
%10 = load i64, i64* %1
%11 = add i64 %10, 1
store i64 %11, i64* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ERR_asprintf_error_data(char *, unsigned char const *, int);
void asn1_add_error(const unsigned char *address, int offset) {
  ERR_asprintf_error_data("address=%p offset=%d", address, offset);
}


x86 assembly (clang, -O0):
<asn1_add_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <ERR_asprintf_error_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_add_error>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <ERR_asprintf_error_data@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"address=%p offset=%d\00"
define void @asn1_add_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @ERR_asprintf_error_data(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"address=%p offset=%d\00"
define void @asn1_add_error(i8* %0, i32 %1) {
%3 = tail call i32 @ERR_asprintf_error_data(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int statx(char const *, struct stat *, int, int);
int __lxstat(int ver, const char *pathname, struct stat *st) {
  assert(ver == 0);
  return statx(pathname, st, sizeof(*st), 0x01);
}


x86 assembly (clang, -O0):
<__lxstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
mov    $0x1,%ecx
call   1040 <statx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lxstat>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
xor    %eax,%eax
test   %edi,%edi
sete   %al
mov    %eax,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
mov    $0x1,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <statx@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @__lxstat(i32 %0, i8* %1, %struct.stat* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.stat*
store i32 %0, i32* %4
store i8* %1, i8** %5
store %struct.stat* %2, %struct.stat** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %5
%12 = load %struct.stat*, %struct.stat** %6
%13 = call i32 @statx(i8* %11, %struct.stat* %12, i32 4, i32 1)
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @__lxstat(i32 %0, i8* %1, %struct.stat* %2) {
%4 = icmp eq i32 %0, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @statx(i8* %1, %struct.stat* %2, i32 4, i32 1)
ret i32 %7
}
sprintf(str, fmt, args) char *str;
char *fmt;
{
  int sprntf();
  char *s;
  s = str;
  _doprnt(fmt, &args, sprntf, &s);
  *s++ = '\0';
  return ((int)str);
}


x86 assembly (clang, -O0):
<sprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    0x2ea6(%rip),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1030 <_doprnt@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprintf>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
mov    %edx,0x4(%rsp)
mov    %rdi,0x8(%rsp)
mov    0x2eb5(%rip),%rdx
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   1030 <_doprnt@plt>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sprintf(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
%9 = load i8*, i8** %5
%10 = call i32 (i8*, i32*, i32 (...)*, i8**, ...) bitcast (i32 (...)* @_doprnt to i32 (i8*, i32*, i32 (...)*, i8**, ...)*)(i8* %9, i32* %6, i32 (...)* @sprntf, i8** %7)
%11 = load i8*, i8** %7
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %7
store i8 0, i8* %11
%13 = load i8*, i8** %4
%14 = ptrtoint i8* %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @sprintf(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
store i32 %2, i32* %4
%6 = bitcast i8** %5 to i8*
store i8* %0, i8** %5
%7 = call i32 (i8*, i32*, i32 (...)*, i8**, ...) bitcast (i32 (...)* @_doprnt to i32 (i8*, i32*, i32 (...)*, i8**, ...)*)(i8* %1, i32* %4, i32 (...)* @sprntf, i8** %5)
%8 = load i8*, i8** %5
store i8 0, i8* %8
%9 = ptrtoint i8* %0 to i64
%10 = trunc i64 %9 to i32
ret i32 %10
}
/* Type definitions */
struct Heap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct Heap *);
void freeMinHeap(struct Heap *h) { free(h); }


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

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

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

LLVM IR (-O2):
%struct.Heap = type { i32 }
define void @freeMinHeap(%struct.Heap* nocapture %0) {
%2 = tail call i32 @free(%struct.Heap* %0)
ret void
}
const char *snd_asoundlib_version(void) { return "1.0.25"; }


x86 assembly (clang, -O0):
<snd_asoundlib_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<snd_asoundlib_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"1.0.25\00"
define i8* @snd_asoundlib_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"1.0.25\00"
define i8* @snd_asoundlib_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
int test_imm_27int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x27 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_27int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 39
%7 = icmp ne i64 %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_27int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 2555904
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double rint(double r) {
  if (r < 0.0)
    return (r + (1024. * 1024. * 1024. * 1024. * 1024. * 8.)) -
           (1024. * 1024. * 1024. * 1024. * 1024. * 8.);
  else
    return (r - (1024. * 1024. * 1024. * 1024. * 1024. * 8.)) +
           (1024. * 1024. * 1024. * 1024. * 1024. * 8.);
}


x86 assembly (clang, -O0):
<rint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    113a <rint+0x3a>
movsd  0xee1(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115c <rint+0x5c>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xead(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rint>:
movsd  0xef8(%rip),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0xef0(%rip),%xmm3
addsd  %xmm3,%xmm2
addsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
xorpd  %xmm1,%xmm1
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm3,%xmm0
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @rint(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fadd double %7, 0x4340000000000000
%9 = fsub double %8, 0x4340000000000000
store double %9, double* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fsub double %11, 0x4340000000000000
%13 = fadd double %12, 0x4340000000000000
store double %13, double* %2
br label %14
14: ; preds = %10, %6
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @rint(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fadd double %0, 0x4340000000000000
%4 = fadd double %3, 0xC340000000000000
%5 = fadd double %0, 0xC340000000000000
%6 = fadd double %5, 0x4340000000000000
%7 = select i1 %2, double %4, double %6
ret double %7
}
int main() {
  int i = 0;
  while ((i = 10)) {
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %4, %0
store i32 10, i32* %2
br label %4
4: ; preds = %3
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void show_usage(char *cmd) {
  printf("usage: %s [num_frames] [framerate]\n", cmd);
  printf("  where num_frames can be a number or 'forever'\n");
  printf("  where where framerate is a floating point number, e.g. 30\n");
  exit(1);
}


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<show_usage>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"usage: %s [num_frames] [framerate]\0A\00"
@.str.1 = [49 x i8] c" where num_frames can be a number or 'forever'\0A\00"
@.str.2 = [61 x i8] c" where where framerate is a floating point number, e.g. 30\0A\00"
define void @show_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [36 x i8] c"usage: %s [num_frames] [framerate]\0A\00"
@str = [48 x i8] c" where num_frames can be a number or 'forever'\00"
@str.3 = [60 x i8] c" where where framerate is a floating point number, e.g. 30\00"
define void @show_usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
float half_to_float_slow(unsigned short h) {
  unsigned f = ((h & 0x8000) << 16) | (((h & 0x7c00) + 0x1C000) << 13) |
               ((h & 0x03FF) << 13);
  return *(float *)&f;
}


x86 assembly (clang, -O0):
<half_to_float_slow>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0x8000,%eax
shl    $0x10,%eax
movzwl -0x2(%rbp),%ecx
and    $0x7c00,%ecx
add    $0x1c000,%ecx
shl    $0xd,%ecx
or     %ecx,%eax
movzwl -0x2(%rbp),%ecx
and    $0x3ff,%ecx
shl    $0xd,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<half_to_float_slow>:
mov    %edi,%eax
shl    $0x10,%eax
and    $0x80000000,%eax
shl    $0xd,%edi
mov    %edi,%ecx
and    $0xf800000,%ecx
or     %eax,%ecx
and    $0x7fe000,%edi
lea    (%rdi,%rcx,1),%eax
add    $0x38000000,%eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
define float @half_to_float_slow(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = and i32 %5, 32768
%7 = shl i32 %6, 16
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = and i32 %9, 31744
%11 = add nsw i32 %10, 114688
%12 = shl i32 %11, 13
%13 = or i32 %7, %12
%14 = load i16, i16* %2
%15 = zext i16 %14 to i32
%16 = and i32 %15, 1023
%17 = shl i32 %16, 13
%18 = or i32 %13, %17
store i32 %18, i32* %3
%19 = bitcast i32* %3 to float*
%20 = load float, float* %19
ret float %20
}

LLVM IR (-O2):
define float @half_to_float_slow(i16 zeroext %0) {
%2 = zext i16 %0 to i32
%3 = sext i16 %0 to i32
%4 = and i32 %3, -2147483648
%5 = shl nuw nsw i32 %2, 13
%6 = and i32 %5, 260046848
%7 = add nuw nsw i32 %6, 939524096
%8 = or i32 %7, %4
%9 = and i32 %5, 8380416
%10 = or i32 %8, %9
%11 = bitcast i32 %10 to float
ret float %11
}
/* Variables and functions */
int /*<<< orphan*/ fs_hmac_generic(unsigned char const *, int, unsigned char *,
                                   int, unsigned char *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ wbe16(unsigned char *, short);
void fs_hmac_meta(const unsigned char *super_data, short super_blk,
                  unsigned char *hmac) {
  unsigned char extra[0x40];
  memset(extra, 0, 0x40);
  wbe16(extra + 0x12, super_blk);
  fs_hmac_generic(super_data, 0x40000, extra, 0x40, hmac);
}


x86 assembly (clang, -O0):
<fs_hmac_meta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
lea    -0x60(%rbp),%rdi
add    $0x12,%rdi
movswl -0xa(%rbp),%esi
call   1050 <wbe16@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
mov    -0x18(%rbp),%r8
mov    $0x40000,%esi
mov    $0x40,%ecx
call   1040 <fs_hmac_generic@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_hmac_meta>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
lea    0x12(%rsp),%rdi
mov    %ebp,%esi
call   1050 <wbe16@plt>
mov    %rbx,%rdi
mov    $0x40000,%esi
mov    %r15,%rdx
mov    $0x40,%ecx
mov    %r14,%r8
call   1040 <fs_hmac_generic@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fs_hmac_meta(i8* %0, i16 signext %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i8*
%7 = alloca [64 x i8]
store i8* %0, i8** %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 64)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 18
%12 = load i16, i16* %5
%13 = call i32 @wbe16(i8* %11, i16 signext %12)
%14 = load i8*, i8** %4
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%16 = load i8*, i8** %6
%17 = call i32 @fs_hmac_generic(i8* %14, i32 262144, i8* %15, i32 64, i8* %16)
ret void
}

LLVM IR (-O2):
define void @fs_hmac_meta(i8* %0, i16 signext %1, i8* %2) {
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 64)
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 18
%8 = call i32 @wbe16(i8* %7, i16 signext %1)
%9 = call i32 @fs_hmac_generic(i8* %0, i32 262144, i8* %5, i32 64, i8* %2)
ret void
}
void hello(void) {
  int i = 0;
  char *hello_str = "helloworld";
  long *paddr = (long *)0x80000070;
  char c = 'w';
  int timeout;
  i = *hello_str - 'h';
  while (1) {
    timeout = 0;
    while (++timeout != 1000000)
      ;
    for (i = 0; i < 10; i++) {
      *paddr = hello_str[i];
    }
  }
  return;
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    0xeee(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    $0x80000070,%eax
mov    %rax,-0x18(%rbp)
movb   $0x77,-0x19(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x68,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmp    $0xf4240,%eax
je     1150 <hello+0x50>
jmp    1137 <hello+0x37>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1183 <hello+0x83>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsbq (%rax,%rcx,1),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <hello+0x57>
jmp    1130 <hello+0x30>

x86 assembly (clang, -O2):
<hello>:
mov    $0x80000070,%eax
movq   $0x64,(%rax)
nopl   0x0(%rax)
jmp    1110 <hello+0x10>

LLVM IR (-O0):
@.str = [11 x i8] c"helloworld\00"
define void @hello() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64*
%4 = alloca i8
%5 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
store i64* inttoptr (i64 2147483760 to i64*), i64** %3
store i8 119, i8* %4
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 104
store i32 %9, i32* %1
br label %10
10: ; preds = %0, %31
store i32 0, i32* %5
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
store i32 %13, i32* %5
%14 = icmp ne i32 %13, 1000000
br i1 %14, label %15, label %16
15: ; preds = %11
br label %11
16: ; preds = %11
store i32 0, i32* %1
br label %17
17: ; preds = %28, %16
%18 = load i32, i32* %1
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load i8*, i8** %2
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i64
%27 = load i64*, i64** %3
store i64 %26, i64* %27
br label %28
28: ; preds = %20
%29 = load i32, i32* %1
%30 = add nsw i32 %29, 1
store i32 %30, i32* %1
br label %17
31: ; preds = %17
br label %10
}

LLVM IR (-O2):
define void @hello() {
store i64 100, i64* inttoptr (i64 2147483760 to i64*)
br label %1
1: ; preds = %1, %0
br label %1
}
float sq(float f) { return f * f; }


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

x86 assembly (clang, -O2):
<sq>:
mulss  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define float @sq(float %0) {
%2 = fmul float %0, %0
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ eprintf(char *, size_t);
void *malloc(size_t);
void *emalloc(size_t n) {
  void *p;
  p = malloc(n);
  if (p == NULL)
    eprintf("malloc of %u bytes failed:", n);
  return p;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <emalloc+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1040 <eprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <emalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <eprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"malloc of %u bytes failed:\00"
define i8* @emalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i32 @eprintf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [27 x i8] c"malloc of %u bytes failed:\00"
define noalias i8* @emalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @eprintf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t sumtoby(uint64_t n, uint64_t m) {
  n = (n - 1) / m;
  return ((n + 1) * n / 2) * m;
}


x86 assembly (clang, -O0):
<sumtoby>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumtoby>:
lea    -0x1(%rdi),%eax
cltd
idiv   %esi
lea    0x1(%rax),%ecx
imul   %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
sar    %eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @sumtoby(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 = sub nsw i32 %5, 1
%7 = load i32, i32* %4
%8 = sdiv i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = load i32, i32* %3
%12 = mul nsw i32 %10, %11
%13 = sdiv i32 %12, 2
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @sumtoby(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -1
%4 = sdiv i32 %3, %1
%5 = add nsw i32 %4, 1
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %6, 2
%8 = mul nsw i32 %7, %1
ret i32 %8
}
/* Variables and functions */
size_t strlen(char const *);
__attribute__((pure)) size_t str_len(const char *restrict str) {
  if (!str)
    return 0;
  return strlen(str);
}


x86 assembly (clang, -O0):
<str_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <str_len+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1141 <str_len+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @str_len(i8* noalias %0) {
%2 = alloca i64
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i64 0, i64* %2
br label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %2
br label %10
10: ; preds = %7, %6
%11 = load i64, i64* %2
ret i64 %11
}

LLVM IR (-O2):
define i64 @str_len(i8* noalias %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i64 [ %4, %3 ], [ 0, %1 ]
ret i64 %6
}
/* Variables and functions */
int strcmp(char *, char *);
int cmpChar(char *first, char *second) {
  if (first && second) {
    return strcmp(first, second);
  }
}


x86 assembly (clang, -O0):
<cmpChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <cmpChar+0x36>
cmpq   $0x0,-0x18(%rbp)
je     1146 <cmpChar+0x36>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpChar>:
test   %rdi,%rdi
je     111f <cmpChar+0xf>
test   %rsi,%rsi
je     111f <cmpChar+0xf>
jmp    1030 <strcmp@plt>
ret

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

LLVM IR (-O2):
define i32 @cmpChar(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* %0, i8* %1)
br label %8
8: ; preds = %6, %2
%9 = phi i32 [ %7, %6 ], [ undef, %2 ]
ret i32 %9
}
int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.wiphy = type opaque
define i32 @ath6kl_tm_cmd(%struct.wiphy* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}