xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *procedimiento(void *in) {
  int tid = (int)in;
  printf("Hola soy la hebra %d\n", tid);
}


x86 assembly (clang, -O0):
<procedimiento>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [22 x i8] c"Hola soy la hebra %d\0A\00"
define i8* @procedimiento(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [22 x i8] c"Hola soy la hebra %d\0A\00"
define noalias i8* @procedimiento(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* undef
}
/* Type definitions */
typedef int __u_char;

/* Variables and functions */
int /*<<< orphan*/ _IO(int, int);
int ioctl(int, int /*<<< orphan*/, int);
int cbm_close(int f, __u_char dev, __u_char secadr) {
  return ioctl(f, _IO(0xcb, 5), (dev << 8) | secadr);
}


x86 assembly (clang, -O0):
<cbm_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0xcb,%edi
mov    $0x5,%esi
call   1030 <_IO@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
mov    -0x8(%rbp),%edx
shl    $0x8,%edx
or     -0xc(%rbp),%edx
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbm_close>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
mov    $0xcb,%edi
mov    $0x5,%esi
call   1030 <_IO@plt>
shl    $0x8,%ebp
or     %ebp,%ebx
mov    %r14d,%edi
mov    %eax,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @cbm_close(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = call i32 @_IO(i32 203, i32 5)
%9 = load i32, i32* %5
%10 = shl i32 %9, 8
%11 = load i32, i32* %6
%12 = or i32 %10, %11
%13 = call i32 @ioctl(i32 %7, i32 %8, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @cbm_close(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @_IO(i32 203, i32 5)
%5 = shl i32 %1, 8
%6 = or i32 %5, %2
%7 = tail call i32 @ioctl(i32 %0, i32 %4, i32 %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void printN(int n) {
  for (; n >= 0; n -= 1) {
    putchar(' ');
  }
}


x86 assembly (clang, -O0):
<printN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     113d <printN+0x2d>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <printN+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printN>:
push   %rbx
test   %edi,%edi
js     112f <printN+0x1f>
mov    %edi,%ebx
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <printN+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @printN(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %8, %1
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 @putchar(i8 signext 32)
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @printN(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @putchar(i8 signext 32)
%6 = add nsw i32 %4, -1
%7 = icmp eq i32 %4, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
three5(a, b, c) { nop(); }


x86 assembly (clang, -O0):
<three5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1030 <nop@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @three5(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @nop()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void f(char *p) {
  if (p)
    free(p);
}


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

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

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

LLVM IR (-O2):
define void @f(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int isfinite(double);
int finite(double x) { return isfinite(x); }


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

x86 assembly (clang, -O2):
<finite>:
jmp    1030 <isfinite@plt>

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

LLVM IR (-O2):
define i32 @finite(double %0) {
%2 = tail call i32 @isfinite(double %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ real_renderer_notify_res_change();
int /*<<< orphan*/ renderer_sync();
void renderer_notify_res_change(void) {
  renderer_sync();
  real_renderer_notify_res_change();
}


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

x86 assembly (clang, -O2):
<renderer_notify_res_change>:
push   %rax
xor    %eax,%eax
call   1040 <renderer_sync@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <real_renderer_notify_res_change@plt>

LLVM IR (-O0):
define void @renderer_notify_res_change() {
%1 = call i32 (...) @renderer_sync()
%2 = call i32 (...) @real_renderer_notify_res_change()
ret void
}

LLVM IR (-O2):
define void @renderer_notify_res_change() {
%1 = tail call i32 (...) @renderer_sync()
%2 = tail call i32 (...) @real_renderer_notify_res_change()
ret void
}
int mod(int a, int b) {
  if (b < 0)
    return mod(-a, -b);
  int ret = a % b;
  if (ret < 0)
    ret += b;
  return ret;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    113f <mod+0x2f>
xor    %edi,%edi
sub    -0x8(%rbp),%edi
xor    %esi,%esi
sub    -0xc(%rbp),%esi
call   1030 <mod@plt>
mov    %eax,-0x4(%rbp)
jmp    1162 <mod+0x52>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    115c <mod+0x4c>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
mov    %edi,%eax
test   %esi,%esi
js     110a <mod+0xa>
mov    %esi,%ecx
jmp    111a <mod+0x1a>
mov    %esi,%ecx
nopl   0x0(%rax)
neg    %eax
neg    %ecx
test   %esi,%esi
mov    %ecx,%esi
jg     1110 <mod+0x10>
cltd
idiv   %ecx
mov    %edx,%eax
sar    $0x1f,%eax
and    %ecx,%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = sub nsw i32 0, %6
%8 = sub nsw i32 0, %5
%9 = icmp sgt i32 %5, 0
br i1 %9, label %4, label %10
10: ; preds = %4, %2
%11 = phi i32 [ %0, %2 ], [ %7, %4 ]
%12 = phi i32 [ %1, %2 ], [ %8, %4 ]
%13 = srem i32 %11, %12
%14 = icmp slt i32 %13, 0
%15 = select i1 %14, i32 %12, i32 0
%16 = add nsw i32 %15, %13
ret i32 %16
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void file_logger_close(FILE *fd) {
  if (fd != NULL) {
    fclose(fd);
  }
}


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

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

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

LLVM IR (-O2):
define void @file_logger_close(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fclose(i32* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *program) {
  printf("Usage:\n%s [-t work mode [send/recv]] [-p port] [-h help] \n",
         program);
  printf("example: \n");
  printf("\t%s -t send -p 8000 \n", program);
}


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

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

LLVM IR (-O0):
@.str = [59 x i8] c"Usage:\0A%s [-t work mode [send/recv]] [-p port] [-h help] \0A\00"
@.str.1 = [11 x i8] c"example: \0A\00"
@.str.2 = [22 x i8] c"\09%s -t send -p 8000 \0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [59 x i8] c"Usage:\0A%s [-t work mode [send/recv]] [-p port] [-h help] \0A\00"
@.str.2 = [22 x i8] c"\09%s -t send -p 8000 \0A\00"
@str = [10 x i8] c"example: \00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
void BIO_get_ex_new_index(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_get_ex_new_index() {
ret void
}
int test_imm_D4int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xD4 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D4int64_highword_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, 32
%6 = and i64 %5, 212
%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_D4int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 910533066752
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int nc = 0;
  for (nc = 0; (getchar()) != EOF; nc++)
    ;
  printf("%d\n", nc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%rax
je     1167 <main+0x47>
jmp    1159 <main+0x39>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
mov    0x2eb8(%rip),%r14
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    (%r14),%rax
jne    1130 <main+0x10>
lea    0xeba(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i64 (...) @getchar()
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
%6 = add nuw nsw i32 %2, 1
br i1 %5, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cfmakeraw(struct termios *);
void sancus_serial_setup_raw(struct termios *tio) { cfmakeraw(tio); }


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

x86 assembly (clang, -O2):
<sancus_serial_setup_raw>:
jmp    1030 <cfmakeraw@plt>

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

LLVM IR (-O2):
%struct.termios = type { i32 }
define void @sancus_serial_setup_raw(%struct.termios* %0) {
%2 = tail call i32 @cfmakeraw(%struct.termios* %0)
ret void
}
int fac(int x) {
  if (x < 2)
    return 1;
  int a;
  a = x - 1;
  int t;
  t = fac(a);
  a = a - 1;
  return t + fac(a);
}


x86 assembly (clang, -O0):
<fac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1131 <fac+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1166 <fac+0x56>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <fac@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <fac@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):
<fac>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jl     1145 <fac+0x35>
mov    %edi,%ebx
add    $0x2,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fac@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x3,%ebx
ja     1130 <fac+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fac(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fac(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Variables and functions */
void _ZN11OSMetaClassdlEPvm(__attribute__((unused)) void *mem,
                            __attribute__((__unused__)) unsigned long size) {}


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

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

LLVM IR (-O0):
define void @_ZN11OSMetaClassdlEPvm(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @_ZN11OSMetaClassdlEPvm(i8* nocapture %0, i64 %1) {
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ *display;
};
struct TYPE_4__ {
  TYPE_1__ xdestroywindow;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XEvent_xdestroywindow_display(void *_p, void *_v) {
  ((XEvent *)_p)->xdestroywindow.display = (Display *)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xdestroywindow_display>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32* }
define void @set_XEvent_xdestroywindow_display(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_4__*
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
store i32* %6, i32** %10
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xdestroywindow_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
void av_frame_get_pkt_pos() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_get_pkt_pos() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ terminal_putchar(char);
int /*<<< orphan*/ terminal_writestring(char *);
void shell_command_test(int argc, char *argv[]) {
  terminal_writestring("Test message!\n");
  terminal_writestring(argv[0]);
  terminal_putchar('\n');
}


x86 assembly (clang, -O0):
<shell_command_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <terminal_writestring@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <terminal_writestring@plt>
mov    $0xa,%edi
call   1040 <terminal_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shell_command_test>:
push   %rbx
mov    %rsi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <terminal_writestring@plt>
mov    (%rbx),%rdi
call   1030 <terminal_writestring@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <terminal_putchar@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Test message!\0A\00"
define void @shell_command_test(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @terminal_writestring(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @terminal_writestring(i8* %8)
%10 = call i32 @terminal_putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Test message!\0A\00"
define void @shell_command_test(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = tail call i32 @terminal_writestring(i8* %4)
%6 = tail call i32 @terminal_putchar(i8 signext 10)
ret void
}
/* Variables and functions */
int pow(double, int);
double f(double x) { return (pow(x, 3) - 5 * pow(x, 2) + 7 * x - 3); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
mov    %eax,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   $0x5,%ecx,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe97(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    $0x3,%edi
call   1030 <pow@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
cvtsi2sd %ebx,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0xeb2(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0xeae(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @pow(double %3, i32 3)
%5 = load double, double* %2
%6 = call i32 @pow(double %5, i32 2)
%7 = mul nsw i32 5, %6
%8 = sub nsw i32 %4, %7
%9 = sitofp i32 %8 to double
%10 = load double, double* %2
%11 = call double @llvm.fmuladd.f64(double 7.000000e+00, double %10, double %9)
%12 = fsub double %11, 3.000000e+00
ret double %12
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call i32 @pow(double %0, i32 3)
%3 = tail call i32 @pow(double %0, i32 2)
%4 = mul i32 %3, -5
%5 = add i32 %4, %2
%6 = sitofp i32 %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %0, double 7.000000e+00, double %6)
%8 = fadd double %7, -3.000000e+00
ret double %8
}
void dgemm_block(double *a, double *b, double *c, int n) {}


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

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

LLVM IR (-O0):
define void @dgemm_block(double* %0, double* %1, double* %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @dgemm_block(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3) {
ret void
}
double pow10_argp(int exp) {
  double result = 1;
  while (exp) {
    result *= 10;
    exp--;
  }
  return result;
}


x86 assembly (clang, -O0):
<pow10_argp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  0xef1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113e <pow10_argp+0x3e>
movsd  0xee2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1114 <pow10_argp+0x14>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow10_argp>:
test   %edi,%edi
je     1134 <pow10_argp+0x34>
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x7,%ecx
je     113d <pow10_argp+0x3d>
xor    %edx,%edx
movsd  0xee8(%rip),%xmm0
movsd  0xee8(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x1,%edx
cmp    %edx,%ecx
jne    1120 <pow10_argp+0x20>
sub    %edx,%edi
cmp    $0x7,%eax
jae    114a <pow10_argp+0x4a>
jmp    1185 <pow10_argp+0x85>
movsd  0xec4(%rip),%xmm0
ret
movsd  0xebb(%rip),%xmm0
cmp    $0x7,%eax
jb     1185 <pow10_argp+0x85>
movsd  0xeb6(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
add    $0xfffffff8,%edi
jne    1160 <pow10_argp+0x60>
ret

LLVM IR (-O0):
define double @pow10_argp(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
store double 1.000000e+00, double* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load double, double* %3
%9 = fmul double %8, 1.000000e+01
store double %9, double* %3
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
br label %4
12: ; preds = %4
%13 = load double, double* %3
ret double %13
}

LLVM IR (-O2):
define double @pow10_argp(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %33, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = and i32 %0, 7
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi double [ %11, %7 ], [ 1.000000e+00, %3 ]
%9 = phi i32 [ %12, %7 ], [ %0, %3 ]
%10 = phi i32 [ %13, %7 ], [ 0, %3 ]
%11 = fmul double %8, 1.000000e+01
%12 = add nsw i32 %9, -1
%13 = add i32 %10, 1
%14 = icmp eq i32 %13, %5
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi double [ undef, %3 ], [ %11, %7 ]
%17 = phi double [ 1.000000e+00, %3 ], [ %11, %7 ]
%18 = phi i32 [ %0, %3 ], [ %12, %7 ]
%19 = icmp ult i32 %4, 7
br i1 %19, label %33, label %20
20: ; preds = %15, %20
%21 = phi double [ %30, %20 ], [ %17, %15 ]
%22 = phi i32 [ %31, %20 ], [ %18, %15 ]
%23 = fmul double %21, 1.000000e+01
%24 = fmul double %23, 1.000000e+01
%25 = fmul double %24, 1.000000e+01
%26 = fmul double %25, 1.000000e+01
%27 = fmul double %26, 1.000000e+01
%28 = fmul double %27, 1.000000e+01
%29 = fmul double %28, 1.000000e+01
%30 = fmul double %29, 1.000000e+01
%31 = add nsw i32 %22, -8
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %20
33: ; preds = %15, %20, %1
%34 = phi double [ 1.000000e+00, %1 ], [ %16, %15 ], [ %30, %20 ]
ret double %34
}
/* Variables and functions */
int power(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int i;
  for (i = 0; i < 30; ++i)
    printf("%d %d %d\n", i, power(2, i), power(-3, i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1e,-0x8(%rbp)
jge    1185 <main+0x65>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x2,%edi
call   1030 <power@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xfffffffd,%edi
call   1030 <power@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    $0x2,%edi
mov    %ebx,%esi
call   1030 <power@plt>
mov    %eax,%ebp
mov    $0xfffffffd,%edi
mov    %ebx,%esi
call   1030 <power@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i32 @power(i32 2, i32 %2)
%4 = tail call i32 @power(i32 -3, i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %4)
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 30
br i1 %7, label %8, label %1
8: ; preds = %1
ret i32 0
}
/* Variables and functions */
const char *safestr(const char *str) {
  if (str == NULL)
    return "";
  else
    return str;
}


x86 assembly (clang, -O0):
<safestr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1123 <safestr+0x23>
lea    0xee6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    112b <safestr+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<safestr>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmovne %rdi,%rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @safestr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
%8 = load i8*, i8** %3
store i8* %8, i8** %2
br label %9
9: ; preds = %7, %6
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @safestr(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void DestroyDateString(char **p) {
  free(*p);
  *p = NULL;
}


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

x86 assembly (clang, -O2):
<DestroyDateString>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @DestroyDateString(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("hello, world\n");
  exit(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>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"hello, world\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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [13 x i8] c"hello, world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
void fooa() {}


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

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

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

LLVM IR (-O2):
define void @fooa() {
ret void
}
void swap_points(double **a, double **b) {
  double *tmp = *a;
  *a = *b;
  *b = tmp;
}


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

x86 assembly (clang, -O2):
<swap_points>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @swap_points(double** %0, double** %1) {
%3 = alloca double**
%4 = alloca double**
%5 = alloca double*
store double** %0, double*** %3
store double** %1, double*** %4
%6 = load double**, double*** %3
%7 = load double*, double** %6
store double* %7, double** %5
%8 = load double**, double*** %4
%9 = load double*, double** %8
%10 = load double**, double*** %3
store double* %9, double** %10
%11 = load double*, double** %5
%12 = load double**, double*** %4
store double* %11, double** %12
ret void
}

LLVM IR (-O2):
define void @swap_points(double** nocapture %0, double** nocapture %1) {
%3 = load double*, double** %0
%4 = load double*, double** %1
store double* %4, double** %0
store double* %3, double** %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
char *get_next_line(int);
int open(char *, int /*<<< orphan*/);
char *my_hostname() {
  int fd;
  char *s;
  if ((fd = open("/etc/hostname", O_RDONLY)) == -1)
    return (NULL);
  s = get_next_line(fd);
  close(fd);
  return (s);
}


x86 assembly (clang, -O0):
<my_hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1040 <open@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1166 <my_hostname+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1182 <my_hostname+0x52>
mov    -0xc(%rbp),%edi
call   1050 <get_next_line@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <close@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_hostname>:
push   %r14
push   %rbx
push   %rax
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xebc(%rip),%rdi
call   1040 <open@plt>
cmp    $0xffffffff,%eax
je     1166 <my_hostname+0x36>
mov    %eax,%ebx
mov    %eax,%edi
call   1050 <get_next_line@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1030 <close@plt>
mov    %r14,%rax
jmp    1168 <my_hostname+0x38>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"/etc/hostname\00"
@O_RDONLY = global i32 0
define i8* @my_hostname() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i8* @get_next_line(i32 %2)
%6 = tail call i32 @close(i32 %2)
br label %7
7: ; preds = %0, %4
%8 = phi i8* [ %5, %4 ], [ null, %0 ]
ret i8* %8
}
int a_int_cmp(const int *x, const int *y) { return *x - *y; }


x86 assembly (clang, -O0):
<a_int_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_int_cmp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

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

LLVM IR (-O2):
define i32 @a_int_cmp(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = sub nsw i32 %3, %4
ret i32 %5
}
void foo094(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo094(i32 %0) {
ret void
}
void ff_hevc_put_hevc_bi_epel_v48_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_v48_12_sse4() {
ret void
}
void done(status) int status;
{
  unset_term();
  printf("\n");
  exit(status);
}


x86 assembly (clang, -O0):
<done>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <unset_term@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<done>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <unset_term@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @done(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @unset_term()
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
unreachable
}

LLVM IR (-O2):
define void @done(i32 %0) {
%2 = tail call i32 (...) @unset_term()
%3 = tail call i32 @putchar(i32 10)
tail call void @exit(i32 %0)
unreachable
}
unsigned char bcd_to_bin(unsigned char c) { return (c / 16) * 10 + (c & 0xf); }


x86 assembly (clang, -O0):
<bcd_to_bin>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
imul   $0xa,%eax,%eax
movzbl -0x1(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd_to_bin>:
mov    %edi,%eax
shr    $0x4,%al
movzbl %al,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
and    $0xf,%dil
add    %dil,%al
ret

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

LLVM IR (-O2):
define zeroext i8 @bcd_to_bin(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = mul nuw i8 %2, 10
%4 = and i8 %0, 15
%5 = add nuw i8 %3, %4
ret i8 %5
}
char cast_ushort_char_fast(unsigned short int x) { return (char)x; }


x86 assembly (clang, -O0):
<cast_ushort_char_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @cast_ushort_char_fast(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = trunc i16 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @cast_ushort_char_fast(i16 zeroext %0) {
%2 = trunc i16 %0 to i8
ret i8 %2
}
int B(int x, int y) { return ((x + y) << 4) + y - x == 17 * y + 15 * x; }


x86 assembly (clang, -O0):
<B>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
shl    $0x4,%eax
add    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
imul   $0x11,-0x8(%rbp),%ecx
imul   $0xf,-0x4(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<B>:
lea    (%rsi,%rdi,1),%eax
shl    $0x4,%eax
mov    %esi,%ecx
shl    $0x4,%ecx
add    %esi,%ecx
mov    %esi,%edx
sub    %edi,%edx
add    %eax,%edx
lea    (%rdi,%rdi,4),%eax
lea    (%rax,%rax,2),%esi
add    %ecx,%esi
xor    %eax,%eax
cmp    %esi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @B(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = shl i32 %7, 4
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
%13 = load i32, i32* %4
%14 = mul nsw i32 17, %13
%15 = load i32, i32* %3
%16 = mul nsw i32 15, %15
%17 = add nsw i32 %14, %16
%18 = icmp eq i32 %12, %17
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @B(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = shl i32 %3, 4
%5 = sub i32 %1, %0
%6 = add i32 %5, %4
%7 = mul nsw i32 %1, 17
%8 = mul nsw i32 %0, 15
%9 = add nsw i32 %7, %8
%10 = icmp eq i32 %6, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
char *k_strcpy(char *dest, const char *src) {
  char *org = dest;
  while ((*dest++ = *src++))
    ;
  return org;
}


x86 assembly (clang, -O0):
<k_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <k_strcpy+0x43>
jmp    1114 <k_strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <k_strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @k_strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
void testClosureDBrV(void (*closure)(double, char), double a1, char a2) {
  (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureDBrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
movsbl -0x11(%rbp),%edi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureDBrV>:
mov    %rdi,%rax
mov    %esi,%edi
jmp    *%rax

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

LLVM IR (-O2):
define void @testClosureDBrV(void (double, i8)* nocapture %0, double %1, i8 signext %2) {
tail call void %0(double %1, i8 signext %2)
ret void
}
int gp2021_detect(unsigned short int address __attribute__((unused))) {
  return 0;
}


x86 assembly (clang, -O0):
<gp2021_detect>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @gp2021_detect(i16 zeroext %0) {
ret i32 0
}