xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ readlink(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void get_filename(int fd, char filename[80]) {
  char path[80];
  sprintf(path, "/proc/self/fd/%d", fd);
  readlink(path, filename, 80);
}


x86 assembly (clang, -O0):
<get_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec3(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x50,%edx
call   1030 <readlink@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_filename>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xecd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x50,%edx
call   1030 <readlink@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/proc/self/fd/%d\00"
define void @get_filename(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [80 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 @readlink(i8* %9, i8* %10, i32 80)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"/proc/self/fd/%d\00"
define void @get_filename(i32 %0, i8* nocapture %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = call i32 @readlink(i8* %4, i8* %1, i32 80)
ret void
}
/* Variables and functions */
int iCode_iter_can_has();
int data_iter_can_has(void) { return iCode_iter_can_has(); }


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

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

LLVM IR (-O0):
define i32 @data_iter_can_has() {
%1 = call i32 (...) @iCode_iter_can_has()
ret i32 %1
}

LLVM IR (-O2):
define i32 @data_iter_can_has() {
%1 = tail call i32 (...) @iCode_iter_can_has()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ CMOS_WRITE(int /*<<< orphan*/, int);
int /*<<< orphan*/ local_flush_tlb();
scalar_t__ phys_to_virt(int);
void smpboot_restore_warm_reset_vector(void) {
  local_flush_tlb();
  CMOS_WRITE(0, 0xf);
  *((volatile long *)phys_to_virt(0x467)) = 0;
}


x86 assembly (clang, -O0):
<smpboot_restore_warm_reset_vector>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <local_flush_tlb@plt>
xor    %edi,%edi
mov    $0xf,%esi
call   1050 <CMOS_WRITE@plt>
mov    $0x467,%edi
call   1030 <phys_to_virt@plt>
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpboot_restore_warm_reset_vector>:
push   %rax
xor    %eax,%eax
call   1040 <local_flush_tlb@plt>
xor    %edi,%edi
mov    $0xf,%esi
call   1050 <CMOS_WRITE@plt>
mov    $0x467,%edi
call   1030 <phys_to_virt@plt>
movq   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @smpboot_restore_warm_reset_vector() {
%1 = call i32 (...) @local_flush_tlb()
%2 = call i32 @CMOS_WRITE(i32 0, i32 15)
%3 = call i64 @phys_to_virt(i32 1127)
%4 = inttoptr i64 %3 to i64*
store volatile i64 0, i64* %4
ret void
}

LLVM IR (-O2):
define void @smpboot_restore_warm_reset_vector() {
%1 = tail call i32 (...) @local_flush_tlb()
%2 = tail call i32 @CMOS_WRITE(i32 0, i32 15)
%3 = tail call i64 @phys_to_virt(i32 1127)
%4 = inttoptr i64 %3 to i64*
store volatile i64 0, i64* %4
ret void
}
/* Type definitions */
struct stat {
  unsigned long st_size;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
unsigned long getFileSize(const char *filename) {
  struct stat s;
  unsigned long result = 0;
  if (stat(filename, &s) == 0) {
    result = s.st_size;
  }
  return result;
}


x86 assembly (clang, -O0):
<getFileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    1143 <getFileSize+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileSize>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
jne    1124 <getFileSize+0x14>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i64 @getFileSize(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %4
%5 = load i8*, i8** %2
%6 = call i64 @stat(i8* %5, %struct.stat* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%10 = load i64, i64* %9
store i64 %10, i64* %4
br label %11
11: ; preds = %8, %1
%12 = load i64, i64* %4
ret i64 %12
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i64 @getFileSize(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i64, i64* %6
%8 = select i1 %5, i64 %7, i64 0
ret i64 %8
}
void TimerTickDisable(void) {}


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

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

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

LLVM IR (-O2):
define void @TimerTickDisable() {
ret void
}
int refHash(int key, int length) { return key % length; }


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

x86 assembly (clang, -O2):
<refHash>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @refHash(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ html(char *);
int /*<<< orphan*/ html_attr(char const *);
void html_hidden(const char *name, const char *value) {
  html("<input type='hidden' name='");
  html_attr(name);
  html("' value='");
  html_attr(value);
  html("'/>");
}


x86 assembly (clang, -O0):
<html_hidden>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <html@plt>
mov    -0x8(%rbp),%rdi
call   1040 <html_attr@plt>
lea    0xed0(%rip),%rdi
call   1030 <html@plt>
mov    -0x10(%rbp),%rdi
call   1040 <html_attr@plt>
lea    0xec5(%rip),%rdi
call   1030 <html@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_hidden>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <html@plt>
mov    %rbx,%rdi
call   1040 <html_attr@plt>
lea    0xed7(%rip),%rdi
call   1030 <html@plt>
mov    %r14,%rdi
call   1040 <html_attr@plt>
lea    0xecd(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <html@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"<input type='hidden' name='\00"
@.str.1 = [10 x i8] c"' value='\00"
@.str.2 = [4 x i8] c"'/>\00"
define void @html_hidden(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 @html(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 @html_attr(i8* %6)
%8 = call i32 @html(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %4
%10 = call i32 @html_attr(i8* %9)
%11 = call i32 @html(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"<input type='hidden' name='\00"
@.str.1 = [10 x i8] c"' value='\00"
@.str.2 = [4 x i8] c"'/>\00"
define void @html_hidden(i8* %0, i8* %1) {
%3 = tail call i32 @html(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @html_attr(i8* %0)
%5 = tail call i32 @html(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @html_attr(i8* %1)
%7 = tail call i32 @html(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int pop();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ push(int);
int main(int argc, char **argv) {
  push(1);
  push(2);
  push(3);
  printf("%i", pop());
  printf("%i", pop());
  printf("%i", pop());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <push@plt>
mov    $0x2,%edi
call   1050 <push@plt>
mov    $0x3,%edi
call   1050 <push@plt>
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,%esi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%i\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 @push(i32 1)
%7 = call i32 @push(i32 2)
%8 = call i32 @push(i32 3)
%9 = call i32 (...) @pop()
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @pop()
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @pop()
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @push(i32 1)
%4 = tail call i32 @push(i32 2)
%5 = tail call i32 @push(i32 3)
%6 = tail call i32 (...) @pop()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @pop()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @pop()
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}
double f4_cb_send_pre_int_int_int_int_int_int_short(double (*cb)(int, int, int,
                                                                 int, int, int,
                                                                 short)) {
  short r = -22;
  return cb(8, 9, 10, 11, 12, 13, r) + 1.0;
}


x86 assembly (clang, -O0):
<f4_cb_send_pre_int_int_int_int_int_int_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0xffea,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x8,%edi
mov    $0x9,%esi
mov    $0xa,%edx
mov    $0xb,%ecx
mov    $0xc,%r8d
mov    $0xd,%r9d
movswl -0xa(%rbp),%r10d
mov    %r10d,(%rsp)
call   *%rax
movsd  0xeb7(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_cb_send_pre_int_int_int_int_int_int_short>:
push   %rax
mov    %rdi,%rax
movl   $0xffffffea,(%rsp)
mov    $0x8,%edi
mov    $0x9,%esi
mov    $0xa,%edx
mov    $0xb,%ecx
mov    $0xc,%r8d
mov    $0xd,%r9d
call   *%rax
addsd  0xecb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f4_cb_send_pre_int_int_int_int_int_int_short(double (i32, i32, i32, i32, i32, i32, i16)* %0) {
%2 = alloca double (i32, i32, i32, i32, i32, i32, i16)*
%3 = alloca i16
store double (i32, i32, i32, i32, i32, i32, i16)* %0, double (i32, i32, i32, i32, i32, i32, i16)** %2
store i16 -22, i16* %3
%4 = load double (i32, i32, i32, i32, i32, i32, i16)*, double (i32, i32, i32, i32, i32, i32, i16)** %2
%5 = load i16, i16* %3
%6 = call double %4(i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i16 signext %5)
%7 = fadd double %6, 1.000000e+00
ret double %7
}

LLVM IR (-O2):
define double @f4_cb_send_pre_int_int_int_int_int_int_short(double (i32, i32, i32, i32, i32, i32, i16)* nocapture %0) {
%2 = tail call double %0(i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i16 signext -22)
%3 = fadd double %2, 1.000000e+00
ret double %3
}
void foo_2_1_2_2_1_1_2_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_2_2_1_1_2_1_1() {
ret void
}
void bar_float() { __real foo_float(); }


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

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

LLVM IR (-O0):
define void @bar_float() {
%1 = call i32 (...) @foo_float()
ret void
}

LLVM IR (-O2):
define void @bar_float() {
%1 = tail call i32 (...) @foo_float()
ret void
}
int euler_problem_6() {
  return (100 * (100 + 1) / 2) * (100 * (100 + 1) / 2) -
         100 * (100 + 1) * (2 * 100 + 1) / 6;
}


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

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

LLVM IR (-O0):
define i32 @euler_problem_6() {
ret i32 25164150
}

LLVM IR (-O2):
define i32 @euler_problem_6() {
ret i32 25164150
}
/* Variables and functions */
int /*<<< orphan*/ c_nnpntend();
void nnpntend_() { c_nnpntend(); }


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

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

LLVM IR (-O0):
define void @nnpntend_() {
%1 = call i32 (...) @c_nnpntend()
ret void
}

LLVM IR (-O2):
define void @nnpntend_() {
%1 = tail call i32 (...) @c_nnpntend()
ret void
}
char other(char player) {
  if (player == 'X')
    return 'O';
  else
    return 'X';
}


x86 assembly (clang, -O0):
<other>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x58,%eax
jne    1120 <other+0x20>
movb   $0x4f,-0x1(%rbp)
jmp    1124 <other+0x24>
movb   $0x58,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<other>:
xor    %eax,%eax
cmp    $0x58,%dil
setne  %al
lea    (%rax,%rax,8),%eax
add    $0x4f,%eax
ret

LLVM IR (-O0):
define signext i8 @other(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 88
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 79, i8* %2
br label %9
8: ; preds = %1
store i8 88, i8* %2
br label %9
9: ; preds = %8, %7
%10 = load i8, i8* %2
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @other(i8 signext %0) {
%2 = icmp eq i8 %0, 88
%3 = select i1 %2, i8 79, i8 88
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *const);
int /*<<< orphan*/ stdout;
void subunit_test_start(char const *const name) {
  fprintf(stdout, "test: %s\n", name);
  fflush(stdout);
}


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

x86 assembly (clang, -O2):
<subunit_test_start>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [10 x i8] c"test: %s\0A\00"
define void @subunit_test_start(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [10 x i8] c"test: %s\0A\00"
define void @subunit_test_start(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret void
}
/* Variables and functions */
int rand();
int intN(int n) { return rand() % n; }


x86 assembly (clang, -O0):
<intN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intN>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @intN(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @intN(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
__attribute__((no)) int bar() {
  int a = -1;
  volatile unsigned b = 1U;
  int c = 1;
  c = (a + 972195718) % (b ? 2 : 0);
  if (c == 1)
    ;
  else
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x39f28786,%eax
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x2,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    115a <bar+0x4a>
jmp    115f <bar+0x4f>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
movl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bar() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 -1, i32* %1
store volatile i32 1, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 972195718
%6 = load volatile i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 2, i32 0
%10 = srem i32 %5, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %0
br label %15
14: ; preds = %0
unreachable
15: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @bar() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 1, i32* %1
%3 = load volatile i32, i32* %1
ret i32 0
}
void bar(char *a, char *b) { __builtin_memcpy(a, b, 30000); }


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

x86 assembly (clang, -O2):
<bar>:
mov    $0x7530,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @bar(i8* nocapture writeonly %0, i8* nocapture %1) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(30000) %0, i8* align 1 dereferenceable(30000) %1, i64 30000, i1 false)
ret void
}
/* Type definitions */
typedef scalar_t__ time_t;
typedef scalar_t__ suseconds_t;
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
scalar_t__ utime_get_seconds(int /*<<< orphan*/);
scalar_t__ utime_get_useconds(int /*<<< orphan*/);
void utime_to_timeval(int64_t v, struct timeval *tv) {
  tv->tv_sec = (time_t)utime_get_seconds(v);
  tv->tv_usec = (suseconds_t)utime_get_useconds(v);
}


x86 assembly (clang, -O0):
<utime_to_timeval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <utime_get_seconds@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x4(%rbp),%edi
call   1030 <utime_get_useconds@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utime_to_timeval>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <utime_get_seconds@plt>
mov    %rax,0x8(%rbx)
mov    %ebp,%edi
call   1030 <utime_get_useconds@plt>
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @utime_to_timeval(i32 %0, %struct.timeval* %1) {
%3 = alloca i32
%4 = alloca %struct.timeval*
store i32 %0, i32* %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load i32, i32* %3
%6 = call i64 @utime_get_seconds(i32 %5)
%7 = load %struct.timeval*, %struct.timeval** %4
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
store i64 %6, i64* %8
%9 = load i32, i32* %3
%10 = call i64 @utime_get_useconds(i32 %9)
%11 = load %struct.timeval*, %struct.timeval** %4
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i64 %10, i64* %12
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @utime_to_timeval(i32 %0, %struct.timeval* nocapture writeonly %1) {
%3 = tail call i64 @utime_get_seconds(i32 %0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store i64 %3, i64* %4
%5 = tail call i64 @utime_get_useconds(i32 %0)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store i64 %5, i64* %6
ret void
}
void ff_hevc_put_hevc_uni_w_pel_pixels8_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_pel_pixels8_10_sse4() {
ret void
}
int test_imm_B3int64_highword_reg(long long val) {
  return ((val >> 32) & (0xB3 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B3int64_highword_reg>:
movabs $0xb300000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B3int64_highword_reg(i64 %0) {
%2 = and i64 %0, 768799145984
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ wNotYet(char *);
void wBuiltinDirExists() { wNotYet("DirExists"); }


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"DirExists\00"
define void @wBuiltinDirExists() {
%1 = tail call i32 @wNotYet(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void kfree(const void *mem) { free((void *)mem); }


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

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

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

LLVM IR (-O2):
define void @kfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("TEST\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"TEST\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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"TEST\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct rlimit {
  unsigned long long rlim_max;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ RLIMIT_MEMLOCK;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ perror(char *);
long long unsigned int system_memlock_amount() {
  struct rlimit limits;
  if (-1 == getrlimit(RLIMIT_MEMLOCK, &limits)) {
    perror("getrlimit on RLIMIT_MEMLOCK");
    exit(EXIT_FAILURE);
  }
  return limits.rlim_max;
}


x86 assembly (clang, -O0):
<system_memlock_amount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1050 <getrlimit@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1173 <system_memlock_amount+0x43>
lea    0xea0(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_memlock_amount>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1050 <getrlimit@plt>
cmp    $0xffffffff,%eax
je     114d <system_memlock_amount+0x1d>
mov    (%rsp),%rax
pop    %rcx
ret
lea    0xeac(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.rlimit = type { i64 }
@RLIMIT_MEMLOCK = global i32 0
@.str = [28 x i8] c"getrlimit on RLIMIT_MEMLOCK\00"
@EXIT_FAILURE = global i32 0
define i64 @system_memlock_amount() {
%1 = alloca %struct.rlimit
%2 = load i32, i32* @RLIMIT_MEMLOCK
%3 = call i32 @getrlimit(i32 %2, %struct.rlimit* %1)
%4 = icmp eq i32 -1, %3
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
%10 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
%11 = load i64, i64* %10
ret i64 %11
}

LLVM IR (-O2):
%struct.rlimit = type { i64 }
@RLIMIT_MEMLOCK = global i32 0
@.str = [28 x i8] c"getrlimit on RLIMIT_MEMLOCK\00"
@EXIT_FAILURE = global i32 0
define i64 @system_memlock_amount() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_MEMLOCK
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
%11 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%12 = load i64, i64* %11
ret i64 %12
}
/* Type definitions */
typedef int int8_t;
typedef int /*<<< orphan*/ input;

/* Variables and functions */
int /*<<< orphan*/ test_rebase(int, int *, int, int, int *, int /*<<< orphan*/);
void test_leading_zeros(void) {
  int8_t input[] = {0, 6, 0};
  int8_t expected[] = {0};
  test_rebase(7, input, (sizeof(input) / sizeof(input[0])), 10, expected, 0);
}


x86 assembly (clang, -O0):
<test_leading_zeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%r8
mov    $0x7,%edi
mov    $0x3,%edx
mov    $0xa,%ecx
xor    %r9d,%r9d
call   1040 <test_rebase@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_leading_zeros>:
sub    $0x18,%rsp
mov    0xeee(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xedb(%rip),%rax
mov    %rax,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%r8
mov    $0x7,%edi
mov    $0x3,%edx
mov    $0xa,%ecx
xor    %r9d,%r9d
call   1030 <test_rebase@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_leading_zeros.input = [3 x i32] [i32 0, i32 6, i32 0]
define void @test_leading_zeros() {
%1 = alloca [3 x i32]
%2 = alloca [1 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast [1 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%7 = call i32 @test_rebase(i32 7, i32* %5, i32 3, i32 10, i32* %6, i32 0)
ret void
}

LLVM IR (-O2):
@__const.test_leading_zeros.input = [3 x i32] [i32 0, i32 6, i32 0]
define void @test_leading_zeros() {
%1 = alloca [3 x i32]
%2 = alloca [1 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast [1 x i32]* %2 to i8*
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
store i32 0, i32* %5
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%7 = call i32 @test_rebase(i32 7, i32* %6, i32 3, i32 10, i32* %5, i32 0)
ret void
}
void vrt_rdev_down(struct vrt_realdev *rdev) {}


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

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

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

LLVM IR (-O2):
%struct.vrt_realdev = type opaque
define void @vrt_rdev_down(%struct.vrt_realdev* nocapture %0) {
ret void
}
indreg0regx1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*p0) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<indreg0regx1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
mov    -0x20(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movzwl (%rcx,%rdx,2),%ecx
cmp    %ecx,%eax
jg     1146 <indreg0regx1+0x46>
movl   $0x1,-0x4(%rbp)
jmp    114d <indreg0regx1+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0regx1>:
movzwl (%r8),%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%r9,%rcx,2),%dx
setbe  %al
ret

LLVM IR (-O0):
define i32 @indreg0regx1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16*, i16** %12
%17 = load i16, i16* %16
%18 = zext i16 %17 to i32
%19 = load i16*, i16** %13
%20 = load i32, i32* %11
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i16, i16* %19, i64 %21
%23 = load i16, i16* %22
%24 = zext i16 %23 to i32
%25 = icmp sle i32 %18, %24
br i1 %25, label %26, label %27
26: ; preds = %6
store i32 1, i32* %7
br label %28
27: ; preds = %6
store i32 0, i32* %7
br label %28
28: ; preds = %27, %26
%29 = load i32, i32* %7
ret i32 %29
}

LLVM IR (-O2):
define i32 @indreg0regx1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture %5) {
%7 = load i16, i16* %4
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i16, i16* %5, i64 %8
%10 = load i16, i16* %9
%11 = icmp ule i16 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
void call7k(char c, int i, short s, long l, float f, unsigned char uc, double d,
            unsigned short us, unsigned long ul, unsigned int ui) {
  c = 'a';
  i = 7;
  s = 8;
  l = 7;
  f = 0.3;
  uc = 44;
  d = 0.44;
  us = 77;
  ul = 43;
  ui = 33;
}


x86 assembly (clang, -O0):
<call7k>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x44(%rbp)
mov    %rcx,%rax
mov    -0x44(%rbp),%ecx
mov    %rax,-0x40(%rbp)
mov    %edx,%eax
mov    -0x40(%rbp),%rdx
mov    %eax,-0x34(%rbp)
mov    %esi,%eax
mov    -0x34(%rbp),%esi
mov    %eax,-0x30(%rbp)
mov    %edi,%r8d
mov    -0x30(%rbp),%edi
mov    %r9w,%ax
mov    0x18(%rbp),%r9d
mov    0x10(%rbp),%r9
mov    %r8b,-0x1(%rbp)
mov    %edi,-0x8(%rbp)
mov    %si,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
mov    %cl,-0x1d(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %ax,-0x2a(%rbp)
movb   $0x61,-0x1(%rbp)
movl   $0x7,-0x8(%rbp)
movw   $0x8,-0xa(%rbp)
movq   $0x7,-0x18(%rbp)
movss  0xe92(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movb   $0x2c,-0x1d(%rbp)
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movw   $0x4d,-0x2a(%rbp)
movq   $0x2b,0x10(%rbp)
movl   $0x21,0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @call7k(i8 signext %0, i32 %1, i16 signext %2, i64 %3, float %4, i8 zeroext %5, double %6, i16 zeroext %7, i64 %8, i32 %9) {
%11 = alloca i8
%12 = alloca i32
%13 = alloca i16
%14 = alloca i64
%15 = alloca float
%16 = alloca i8
%17 = alloca double
%18 = alloca i16
%19 = alloca i64
%20 = alloca i32
store i8 %0, i8* %11
store i32 %1, i32* %12
store i16 %2, i16* %13
store i64 %3, i64* %14
store float %4, float* %15
store i8 %5, i8* %16
store double %6, double* %17
store i16 %7, i16* %18
store i64 %8, i64* %19
store i32 %9, i32* %20
store i8 97, i8* %11
store i32 7, i32* %12
store i16 8, i16* %13
store i64 7, i64* %14
store float 0x3FD3333340000000, float* %15
store i8 44, i8* %16
store double 4.400000e-01, double* %17
store i16 77, i16* %18
store i64 43, i64* %19
store i32 33, i32* %20
ret void
}

LLVM IR (-O2):
define void @call7k(i8 signext %0, i32 %1, i16 signext %2, i64 %3, float %4, i8 zeroext %5, double %6, i16 zeroext %7, i64 %8, i32 %9) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x1c() {
  Assert_real((isdigit(28) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              145, ("isdigit should be 0 for 0x1c"));
}


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

x86 assembly (clang, -O2):
<t_isdigit_0x1c>:
push   %rax
mov    $0x1c,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x91,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x1c\00"
define void @t_isdigit_0x1c() {
%1 = call i64 @isdigit(i32 28)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 145, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0x1c\00"
define void @t_isdigit_0x1c() {
%1 = tail call i64 @isdigit(i32 28)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 145, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long serial;
};
typedef TYPE_1__ XSelectionEvent;

/* Variables and functions */
void set_XSelectionEvent_serial(void *_p, unsigned long _v) {
  ((XSelectionEvent *)_p)->serial = (unsigned long)_v;
}


x86 assembly (clang, -O0):
<set_XSelectionEvent_serial>:
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_XSelectionEvent_serial>:
mov    %rsi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XSelectionEvent_serial(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Type definitions */
struct control_plane {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct control_plane *);
void control_plane_destroy(struct control_plane *cp) { free(cp); }


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

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

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

LLVM IR (-O2):
%struct.control_plane = type { i32 }
define void @control_plane_destroy(%struct.control_plane* nocapture %0) {
%2 = tail call i32 @free(%struct.control_plane* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void horizontalRule(void) {
  printf("\n--------------------------------------------------");
}


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

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

LLVM IR (-O0):
@.str = [52 x i8] c"\0A--------------------------------------------------\00"
define void @horizontalRule() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"\0A--------------------------------------------------\00"
define void @horizontalRule() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int swap_bytes32(int);
uint64_t swap_bytes64(uint64_t i) {
  uint64_t res = swap_bytes32(i);
  res <<= 32;
  res |= swap_bytes32(i >> 32);
  return res;
}


x86 assembly (clang, -O0):
<swap_bytes64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <swap_bytes32@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <swap_bytes32@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_bytes64>:
push   %rax
call   1030 <swap_bytes32@plt>
pop    %rax
jmp    1030 <swap_bytes32@plt>

LLVM IR (-O0):
define i32 @swap_bytes64(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @swap_bytes32(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 %6, 32
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = ashr i32 %8, 32
%10 = call i32 @swap_bytes32(i32 %9)
%11 = load i32, i32* %3
%12 = or i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @swap_bytes64(i32 %0) {
%2 = tail call i32 @swap_bytes32(i32 %0)
%3 = tail call i32 @swap_bytes32(i32 poison)
ret i32 poison
}
int omap2_mux_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @omap2_mux_init() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ isspace(unsigned char);
__attribute__((nonnull(1))) char *m_vstrnextsp(char *s) {
  while (*s && !isspace((unsigned char)*s))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<m_vstrnextsp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1148 <m_vstrnextsp+0x38>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1158 <m_vstrnextsp+0x48>
jmp    1169 <m_vstrnextsp+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <m_vstrnextsp+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_vstrnextsp>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1138 <m_vstrnextsp+0x28>
nopw   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <m_vstrnextsp+0x28>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <m_vstrnextsp+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @m_vstrnextsp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %16, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i32 @isspace(i8 zeroext %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br label %14
14: ; preds = %8, %3
%15 = phi i1 [ false, %3 ], [ %13, %8 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %3
19: ; preds = %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @m_vstrnextsp(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i32 @isspace(i8 zeroext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char **argv) {
  int sum = 0;
#pragma acc parallel reduction(+:sum) num_gangs(GANGS) num_workers(WORKERS) vector_length(VECTOR_WIDTH)
  {
#pragma acc loop reduction(+ : sum) gang worker vector
    for (int i = 0; i < ((5) * (10) * (32)); i++) {
      sum = 1;
    }
  }
  printf("sum=%d, expected %d\n", sum, ((5) * (10) * (32)));
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x640,-0x18(%rbp)
jge    1156 <main+0x46>
movl   $0x1,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x640,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [21 x i8] c"sum=%d, expected %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 1, i32 1600)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
FILE *open_key_file(char *kf) { return fopen(kf, "wb"); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define i32* @open_key_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32* %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define noalias i32* @open_key_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32* %2
}