xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdin;
void uninit_fgets(void) {
  FILE *fp;
  char buf[10];
  char *str;
  fgets(buf, 10, stdin);
  fgets(str, 10, stdin);
  fgets(buf, 10, fp);
}


x86 assembly (clang, -O0):
<uninit_fgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x12(%rbp),%rdi
mov    0x2ec5(%rip),%rax
mov    (%rax),%rdx
mov    $0xa,%esi
call   1030 <fgets@plt>
mov    -0x20(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%rdx
mov    $0xa,%esi
call   1030 <fgets@plt>
lea    -0x12(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xa,%esi
call   1030 <fgets@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninit_fgets>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2eca(%rip),%rbx
mov    (%rbx),%rdx
lea    0xe(%rsp),%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <fgets@plt>
mov    (%rbx),%rdx
mov    $0xa,%esi
call   1030 <fgets@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <fgets@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32* null
define void @uninit_fgets() {
%1 = alloca i32*
%2 = alloca [10 x i8]
%3 = alloca i8*
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = load i32*, i32** @stdin
%6 = call i32 @fgets(i8* %4, i32 10, i32* %5)
%7 = load i8*, i8** %3
%8 = load i32*, i32** @stdin
%9 = call i32 @fgets(i8* %7, i32 10, i32* %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = load i32*, i32** %1
%12 = call i32 @fgets(i8* %10, i32 10, i32* %11)
ret void
}

LLVM IR (-O2):
@stdin = global i32* null
define void @uninit_fgets() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = load i32*, i32** @stdin
%4 = call i32 @fgets(i8* %2, i32 10, i32* %3)
%5 = load i32*, i32** @stdin
%6 = call i32 @fgets(i8* undef, i32 10, i32* %5)
%7 = call i32 @fgets(i8* %2, i32 10, i32* undef)
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
double uint64_to_double(uint64_t x) { return (double)x; }


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

x86 assembly (clang, -O2):
<uint64_to_double>:
cvtsi2sd %rdi,%xmm0
ret

LLVM IR (-O0):
define double @uint64_to_double(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sitofp i64 %3 to double
ret double %4
}

LLVM IR (-O2):
define double @uint64_to_double(i64 %0) {
%2 = sitofp i64 %0 to double
ret double %2
}
/* Variables and functions */
double asin(float);
float deg_asin(float deg) { return asin(deg) / 0.01745329251; }


x86 assembly (clang, -O0):
<deg_asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <asin@plt>
movsd  0xed1(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg_asin>:
push   %rax
call   1030 <asin@plt>
divsd  0xee2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @deg_asin(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call double @asin(float %3)
%5 = fdiv double %4, 0x3F91DF46A226E211
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @deg_asin(float %0) {
%2 = tail call double @asin(float %0)
%3 = fdiv double %2, 0x3F91DF46A226E211
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ console_putc(int);
int console_puts(const char *s) {
  char c;
  int i = 0;
  ;
  while ((c = *s++) != (char)0) {
    i++;
    (void)console_putc((int)c);
  }
  return i;
}


x86 assembly (clang, -O0):
<console_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     115a <console_puts+0x4a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <console_putc@plt>
jmp    1123 <console_puts+0x13>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_puts>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1138 <console_puts+0x28>
mov    %rdi,%r14
xor    %ebx,%ebx
nop
movsbl %al,%edi
call   1030 <console_putc@plt>
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <console_puts+0x10>
jmp    113a <console_puts+0x2a>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @console_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = add nuw nsw i32 %6, 1
%11 = tail call i32 @console_putc(i32 %8)
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum(int m) {
  int i = 0, n = 0;
  for (i = 1; i <= m; i += 1)
    n += i;
  printf("The sum of 1-m is %d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1153 <sum+0x43>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <sum+0x20>
mov    -0xc(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %edi,%edi
jle    1129 <sum+0x19>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%esi
add    $0xffffffff,%esi
jmp    112b <sum+0x1b>
xor    %esi,%esi
push   %rax
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"The sum of 1-m is %d\0A\00"
define i32 @sum(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}
void ff_hevc_put_hevc_uni_qpel_hv16_10_avx2() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_qpel_hv16_10_avx2() {
ret void
}
void gtk_window_get_focus() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_get_focus() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ findtarget(int, char *);
xlcleanup(void) { findtarget(16, "not in a break loop"); }


x86 assembly (clang, -O0):
<xlcleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
lea    0xedc(%rip),%rsi
call   1030 <findtarget@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlcleanup>:
lea    0xee9(%rip),%rsi
mov    $0x10,%edi
jmp    1030 <findtarget@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"not in a break loop\00"
define i32 @xlcleanup() {
%1 = alloca i32
%2 = call i32 @findtarget(i32 16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [20 x i8] c"not in a break loop\00"
define i32 @xlcleanup() {
%1 = tail call i32 @findtarget(i32 16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void my_task(void *args) {
  int *i = (int *)args;
  printf("Hello world! Shared copy of args = %d\n", *i);
  ++(*i);
}


x86 assembly (clang, -O0):
<my_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_task>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
addl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Hello world! Shared copy of args = %d\0A\00"
define void @my_task(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"Hello world! Shared copy of args = %d\0A\00"
define void @my_task(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
ret void
}
void gtk_menu_direction_type_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_menu_direction_type_get_type() {
ret void
}
void av_fopen_utf8() {}


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

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

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

LLVM IR (-O2):
define void @av_fopen_utf8() {
ret void
}
int is_branch(unsigned int inst) { return inst << 4 >> 28 == 0xa; }


x86 assembly (clang, -O0):
<is_branch>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
shr    $0x1c,%eax
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_branch>:
and    $0xf000000,%edi
xor    %eax,%eax
cmp    $0xa000000,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_branch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 4
%5 = lshr i32 %4, 28
%6 = icmp eq i32 %5, 10
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_branch(i32 %0) {
%2 = and i32 %0, 251658240
%3 = icmp eq i32 %2, 167772160
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _Warning(long, char *);
void Warning_UndefinedConstantDeprecated(long p_position) {
  _Warning(p_position,
           "Deprecated keyword: use 'nothing' rather than 'undefined'");
}


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

x86 assembly (clang, -O2):
<Warning_UndefinedConstantDeprecated>:
lea    0xee9(%rip),%rsi
jmp    1030 <_Warning@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"Deprecated keyword: use 'nothing' rather than 'undefined'\00"
define void @Warning_UndefinedConstantDeprecated(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Warning(i64 %3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [58 x i8] c"Deprecated keyword: use 'nothing' rather than 'undefined'\00"
define void @Warning_UndefinedConstantDeprecated(i64 %0) {
%2 = tail call i32 @_Warning(i64 %0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t hash_32(uint32_t val, uint32_t bits) {
  uint32_t hash = val * 0x9e370001UL;
  return hash >> (32 - bits);
}


x86 assembly (clang, -O0):
<hash_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x9e370001,%rcx
imul   %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_32>:
mov    %esi,%ecx
imul   $0x9e370001,%edi,%eax
neg    %cl
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @hash_32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 2654404609
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = sub nsw i32 32, %11
%13 = ashr i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @hash_32(i32 %0, i32 %1) {
%3 = mul i32 %0, -1640562687
%4 = sub nsw i32 32, %1
%5 = ashr i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(long **);
int /*<<< orphan*/ freeLongVector(long *);
void freeLongMatrix(long int **matrix, int rows) {
  int i;
  for (i = 0; i < rows; i++)
    freeLongVector(matrix[i]);
  free(matrix);
}


x86 assembly (clang, -O0):
<freeLongMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1161 <freeLongMatrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <freeLongVector@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <freeLongMatrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeLongMatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1152 <freeLongMatrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1040 <freeLongVector@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <freeLongMatrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeLongMatrix(i64** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i64*, i64** %0, i64 %7
%9 = load i64*, i64** %8
%10 = tail call i32 @freeLongVector(i64* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @free(i64** %0)
ret void
}
int fun1094() { return 1094; }


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

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

LLVM IR (-O0):
define i32 @fun1094() {
ret i32 1094
}

LLVM IR (-O2):
define i32 @fun1094() {
ret i32 1094
}
/* Type definitions */
typedef int uint8_t;
typedef int source;

/* Variables and functions */
int /*<<< orphan*/ write_byte(int);
void sub_r64_imm8(uint8_t source, uint8_t imm) {
  write_byte(0x40 | 0x08 | ((source >> 3) & 1));
  write_byte(0x83);
  write_byte(((((3) & 0x3) << 6) | (((0x5) & 0x7) << 3) | ((source)&0x7)));
  write_byte(imm);
}


x86 assembly (clang, -O0):
<sub_r64_imm8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x3,%edi
and    $0x1,%edi
or     $0x48,%edi
call   1030 <write_byte@plt>
mov    $0x83,%edi
call   1030 <write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xe8,%edi
call   1030 <write_byte@plt>
mov    -0x8(%rbp),%edi
call   1030 <write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_r64_imm8>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
shr    $0x3,%edi
and    $0x1,%edi
or     $0x48,%edi
call   1030 <write_byte@plt>
mov    $0x83,%edi
call   1030 <write_byte@plt>
and    $0x7,%ebp
or     $0xe8,%ebp
mov    %ebp,%edi
call   1030 <write_byte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write_byte@plt>

LLVM IR (-O0):
define void @sub_r64_imm8(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 = ashr i32 %5, 3
%7 = and i32 %6, 1
%8 = or i32 72, %7
%9 = call i32 @write_byte(i32 %8)
%10 = call i32 @write_byte(i32 131)
%11 = load i32, i32* %3
%12 = and i32 %11, 7
%13 = or i32 232, %12
%14 = call i32 @write_byte(i32 %13)
%15 = load i32, i32* %4
%16 = call i32 @write_byte(i32 %15)
ret void
}

LLVM IR (-O2):
define void @sub_r64_imm8(i32 %0, i32 %1) {
%3 = lshr i32 %0, 3
%4 = and i32 %3, 1
%5 = or i32 %4, 72
%6 = tail call i32 @write_byte(i32 %5)
%7 = tail call i32 @write_byte(i32 131)
%8 = and i32 %0, 7
%9 = or i32 %8, 232
%10 = tail call i32 @write_byte(i32 %9)
%11 = tail call i32 @write_byte(i32 %1)
ret void
}
/* Variables and functions */
void *_talloc_zero(void const *, size_t, char const *);
void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count,
                         const char *name) {
  if (count >= 0x10000000 / el_size) {
    return NULL;
  }
  return _talloc_zero(ctx, el_size * count, name);
}


x86 assembly (clang, -O0):
<_talloc_zero_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    $0x10000000,%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jb     1158 <_talloc_zero_array+0x48>
movq   $0x0,-0x8(%rbp)
jmp    1174 <_talloc_zero_array+0x64>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%eax
imul   %rax,%rsi
mov    -0x28(%rbp),%rdx
call   1030 <_talloc_zero@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_talloc_zero_array>:
mov    %edx,%r8d
cmp    $0x10000000,%rsi
ja     112d <_talloc_zero_array+0x1d>
mov    $0x10000000,%eax
xor    %edx,%edx
div    %esi
cmp    %r8,%rax
ja     1134 <_talloc_zero_array+0x24>
xor    %eax,%eax
ret
xor    %eax,%eax
cmp    %r8,%rax
jbe    112a <_talloc_zero_array+0x1a>
imul   %rsi,%r8
mov    %r8,%rsi
mov    %rcx,%rdx
jmp    1030 <_talloc_zero@plt>

LLVM IR (-O0):
define i8* @_talloc_zero_array(i8* %0, i64 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%10 = load i32, i32* %8
%11 = zext i32 %10 to i64
%12 = load i64, i64* %7
%13 = udiv i64 268435456, %12
%14 = icmp uge i64 %11, %13
br i1 %14, label %15, label %16
15: ; preds = %4
store i8* null, i8** %5
br label %24
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = load i64, i64* %7
%19 = load i32, i32* %8
%20 = zext i32 %19 to i64
%21 = mul i64 %18, %20
%22 = load i8*, i8** %9
%23 = call i8* @_talloc_zero(i8* %17, i64 %21, i8* %22)
store i8* %23, i8** %5
br label %24
24: ; preds = %16, %15
%25 = load i8*, i8** %5
ret i8* %25
}

LLVM IR (-O2):
define i8* @_talloc_zero_array(i8* %0, i64 %1, i32 %2, i8* %3) {
%5 = zext i32 %2 to i64
%6 = udiv i64 268435456, %1
%7 = icmp ugt i64 %6, %5
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = mul i64 %5, %1
%10 = tail call i8* @_talloc_zero(i8* %0, i64 %9, i8* %3)
br label %11
11: ; preds = %4, %8
%12 = phi i8* [ %10, %8 ], [ null, %4 ]
ret i8* %12
}
/* Variables and functions */
int abs(int);
int getDistance__perimeter(int x1, int x2, int y1, int y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}


x86 assembly (clang, -O0):
<getDistance__perimeter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDistance__perimeter>:
sub    %esi,%edi
mov    %edi,%esi
neg    %esi
cmovs  %edi,%esi
sub    %ecx,%edx
mov    %edx,%eax
neg    %eax
cmovs  %edx,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @getDistance__perimeter(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = sub nsw i32 %9, %10
%12 = call i32 @abs(i32 %11)
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = sub nsw i32 %13, %14
%16 = call i32 @abs(i32 %15)
%17 = add nsw i32 %12, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @getDistance__perimeter(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %1
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
%7 = sub nsw i32 %2, %3
%8 = tail call i32 @llvm.abs.i32(i32 %7, i1 true)
%9 = add nuw nsw i32 %8, %6
ret i32 %9
}
void pwc_set_value(unsigned int gpio, int value) {}


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

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

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

LLVM IR (-O2):
define void @pwc_set_value(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
float M_PI;
float sinf(float);
float wave_sine(float i) { return sinf(M_PI * 2.0f * i); }


x86 assembly (clang, -O0):
<wave_sine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
mov    0x2ebc(%rip),%rax
mulss  (%rax),%xmm0
mulss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wave_sine>:
mov    0x2ed1(%rip),%rax
movss  (%rax),%xmm1
addss  %xmm1,%xmm1
mulss  %xmm1,%xmm0
jmp    1030 <sinf@plt>

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @wave_sine(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* @M_PI
%4 = fmul float %3, 2.000000e+00
%5 = load float, float* %2
%6 = fmul float %4, %5
%7 = call float @sinf(float %6)
ret float %7
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @wave_sine(float %0) {
%2 = load float, float* @M_PI
%3 = fmul float %2, 2.000000e+00
%4 = fmul float %3, %0
%5 = tail call float @sinf(float %4)
ret float %5
}
void f59(void) {
  ({
    ({ 0; });
  a:
    ({
      goto a;
      0;
    });
    0;
  });
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  0;
}


x86 assembly (clang, -O0):
<f59>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <f59+0xb>

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

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

LLVM IR (-O2):
define void @f59() {
br label %1
1: ; preds = %1, %0
br label %1
}
void gtk_check_menu_item_toggled() {}


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

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

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

LLVM IR (-O2):
define void @gtk_check_menu_item_toggled() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int yyparse();
int main(int argc, char *argv[]) {
  int yy;
  yy = yyparse();
  if (yy != 0) {
    printf("Syntax or parse error %i. Aborting.\n", yy);
    return 1;
  } else {
    printf("Success.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <yyparse@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1167 <main+0x47>
mov    -0x14(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    117c <main+0x5c>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <yyparse@plt>
test   %eax,%eax
je     1155 <main+0x25>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
jmp    1161 <main+0x31>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Syntax or parse error %i. Aborting.\0A\00"
@.str.1 = [10 x i8] c"Success.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @yyparse()
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 1, i32* %3
br label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13
store i32 0, i32* %3
br label %16
16: ; preds = %15, %10
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [37 x i8] c"Syntax or parse error %i. Aborting.\0A\00"
@str = [9 x i8] c"Success.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @yyparse()
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
void clean_extract(FILE *extracted_res, char *extracted_res_buf) {
  if (extracted_res) {
    fclose(extracted_res);
  }
  if (extracted_res_buf) {
    free(extracted_res_buf);
  }
}


x86 assembly (clang, -O0):
<clean_extract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1144 <clean_extract+0x24>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0x10(%rbp)
je     1158 <clean_extract+0x38>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_extract>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     112e <clean_extract+0xe>
call   1040 <fclose@plt>
test   %rbx,%rbx
je     113c <clean_extract+0x1c>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @clean_extract(i32* %0, i8* %1) {
%3 = icmp eq i32* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @fclose(i32* %0)
br label %6
6: ; preds = %4, %2
%7 = icmp eq i8* %1, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @free(i8* %1)
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Burning processor...\n");
  int i = 0;
  while (1) {
    if (i < 999999)
      ++i;
    else
      i = 0;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xf423f,-0x8(%rbp)
jge    114d <main+0x3d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x44>
movl   $0x0,-0x8(%rbp)
jmp    1132 <main+0x22>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
nopl   (%rax)
jmp    1120 <main+0x10>

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [21 x i8] c"Burning processor...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
br label %2
}
/* Variables and functions */
scalar_t__ match(char *, char *);
scalar_t__ strcspn(char *, char *);
int wildmat(char *candidate, char *pattern) {
  if (match(candidate, pattern) == strcspn(candidate, "\r\n"))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<wildmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <match@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcspn@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    116d <wildmat+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1174 <wildmat+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wildmat>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <match@plt>
mov    %rax,%r14
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcspn@plt>
xor    %ecx,%ecx
cmp    %rax,%r14
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @wildmat(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 = load i8*, i8** %5
%8 = call i64 @match(i8* %6, i8* %7)
%9 = load i8*, i8** %4
%10 = call i64 @strcspn(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %8, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @wildmat(i8* %0, i8* %1) {
%3 = tail call i64 @match(i8* %0, i8* %1)
%4 = tail call i64 @strcspn(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
char *_stpcpy(char *dst, const char *src) {
  while ((*dst = *src++))
    dst++;
  return dst;
}


x86 assembly (clang, -O0):
<_stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     113c <_stpcpy+0x3c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <_stpcpy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_stpcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     1122 <_stpcpy+0x22>
add    $0x1,%rsi
nop
movzbl (%rsi),%ecx
mov    %cl,0x1(%rax)
add    $0x1,%rax
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <_stpcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @_stpcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %1, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i8* [ %0, %2 ], [ %9, %5 ]
ret i8* %13
}
/* Type definitions */
struct item {
  int dummy;
};

/* Variables and functions */
struct item *find_overlap() {
  struct item *overlap = NULL;
  return overlap;
}


x86 assembly (clang, -O0):
<find_overlap>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.item = type { i32 }
define %struct.item* @find_overlap() {
%1 = alloca %struct.item*
store %struct.item* null, %struct.item** %1
%2 = load %struct.item*, %struct.item** %1
ret %struct.item* %2
}

LLVM IR (-O2):
%struct.item = type { i32 }
define noalias %struct.item* @find_overlap() {
ret %struct.item* null
}
int shr2_local(x)
int x;
{ return 2 * x; }


x86 assembly (clang, -O0):
<shr2_local>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shr2_local>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @shr2_local(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int energy_full();
int energy_now();
int /*<<< orphan*/ sprintf(char *, char *, int);
void battery_status(char *battery_remain) {
  int status;
  status = (int)(energy_now() / energy_full() * 100);
  sprintf(battery_remain, "%d%%", status);
}


x86 assembly (clang, -O0):
<battery_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <energy_now@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <energy_full@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
imul   $0x64,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe97(%rip),%rsi
call   1050 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<battery_status>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <energy_now@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <energy_full@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
imul   $0x64,%eax,%edx
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <sprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d%%\00"
define void @battery_status(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (...) @energy_now()
%5 = call i32 (...) @energy_full()
%6 = sdiv i32 %4, %5
%7 = mul nsw i32 %6, 100
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%%\00"
define void @battery_status(i8* nocapture writeonly %0) {
%2 = tail call i32 (...) @energy_now()
%3 = tail call i32 (...) @energy_full()
%4 = sdiv i32 %2, %3
%5 = mul nsw i32 %4, 100
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
int ft_abs(int i) {
  if (i < 0)
    return (-i);
  return (i);
}


x86 assembly (clang, -O0):
<ft_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <ft_abs+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <ft_abs+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ft_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int col_on_comm(int *Fcomm, int *typesize, void *inbuf, int *ninbuf,
                void *outbuf, int *noutbuf, int sw) {
  return (0);
}


x86 assembly (clang, -O0):
<col_on_comm>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @col_on_comm(i32* nocapture readnone %0, i32* nocapture readnone %1, i8* nocapture readnone %2, i32* nocapture readnone %3, i8* nocapture readnone %4, i32* nocapture readnone %5, i32 %6) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int tgdb_types_source_files_free(void *data) {
  char *s = (char *)data;
  free(s);
  s = NULL;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @tgdb_types_source_files_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 0
}
double frexp(double x, int *exp) { return 4; }


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

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

LLVM IR (-O0):
define double @frexp(double %0, i32* %1) {
%3 = alloca double
%4 = alloca i32*
store double %0, double* %3
store i32* %1, i32** %4
ret double 4.000000e+00
}

LLVM IR (-O2):
define double @frexp(double %0, i32* nocapture readnone %1) {
ret double 4.000000e+00
}
char *salloc(n)
int n;
{
  register char *c, *i;
  extern char *malloc();
  if (!(c = malloc(n)))
    fatal(((char *)0));
  i = c + n;
  while (i != c)
    *--i = 0;
  return (c);
}


x86 assembly (clang, -O0):
<salloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114e <salloc+0x2e>
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1040 <fatal@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1183 <salloc+0x63>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,-0x1(%rax)
jmp    115d <salloc+0x3d>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<salloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115f <salloc+0x2f>
test   %ebp,%ebp
je     1155 <salloc+0x25>
movslq %ebp,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edi,%edi
xor    %eax,%eax
call   1050 <fatal@plt>
test   %ebp,%ebp
jne    1148 <salloc+0x18>
jmp    1155 <salloc+0x25>

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

LLVM IR (-O2):
define i8* @salloc(i32 %0) {
%2 = tail call i8* (i32, ...) bitcast (i8* (...)* @malloc to i8* (i32, ...)*)(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* null)
br label %6
6: ; preds = %4, %1
%7 = icmp eq i32 %0, 0
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = sext i32 %0 to i64
br label %10
10: ; preds = %8, %6
ret i8* %2
}
/* Variables and functions */
int INT_MIN;
signed int ov_imod(signed int a, signed int b, int *ov) {
  if ((b == 0) || ((a == INT_MIN) && (b == -1))) {
    *ov = 1;
    if (b == 0)
      return a;
    else
      return 0;
  }
  return a % b;
}


x86 assembly (clang, -O0):
<ov_imod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1134 <ov_imod+0x34>
mov    -0x8(%rbp),%eax
mov    0x2ec6(%rip),%rcx
cmp    (%rcx),%eax
jne    115f <ov_imod+0x5f>
cmpl   $0xffffffff,-0xc(%rbp)
jne    115f <ov_imod+0x5f>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x0,-0xc(%rbp)
jne    1153 <ov_imod+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <ov_imod+0x69>
movl   $0x0,-0x4(%rbp)
jmp    1169 <ov_imod+0x69>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ov_imod>:
test   %esi,%esi
je     111d <ov_imod+0x1d>
cmp    $0xffffffff,%esi
jne    1126 <ov_imod+0x26>
mov    0x2ed8(%rip),%rcx
xor    %eax,%eax
cmp    %edi,(%rcx)
jne    1126 <ov_imod+0x26>
movl   $0x1,(%rdx)
ret
mov    %edi,%eax
movl   $0x1,(%rdx)
ret
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @ov_imod(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 = load i32, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %3
%11 = load i32, i32* %5
%12 = load i32, i32* @INT_MIN
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %24
17: ; preds = %14, %3
%18 = load i32*, i32** %7
store i32 1, i32* %18
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = load i32, i32* %5
store i32 %22, i32* %4
br label %28
23: ; preds = %17
store i32 0, i32* %4
br label %28
24: ; preds = %14, %10
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = srem i32 %25, %26
store i32 %27, i32* %4
br label %28
28: ; preds = %24, %23, %21
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @ov_imod(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = load i32, i32* @INT_MIN
%7 = icmp eq i32 %6, %0
%8 = icmp eq i32 %1, -1
%9 = and i1 %8, %7
br i1 %9, label %10, label %12
10: ; preds = %5, %3
%11 = phi i32 [ 0, %5 ], [ %0, %3 ]
store i32 1, i32* %2
br label %14
12: ; preds = %5
%13 = srem i32 %0, %1
br label %14
14: ; preds = %10, %12
%15 = phi i32 [ %13, %12 ], [ %11, %10 ]
ret i32 %15
}