xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t align_offset(void *address, size_t alignment) {
  const size_t fraction = (size_t)address % alignment;
  return (fraction == 0) ? 0 : (alignment - fraction);
}


x86 assembly (clang, -O0):
<align_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1132 <align_offset+0x32>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    113e <align_offset+0x3e>
mov    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_offset>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1116 <align_offset+0x16>
xor    %edx,%edx
div    %rsi
jmp    111a <align_offset+0x1a>
xor    %edx,%edx
div    %esi
sub    %rdx,%rsi
test   %rdx,%rdx
cmove  %rdx,%rsi
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @align_offset(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = load i64, i64* %4
%9 = urem i64 %7, %8
store i64 %9, i64* %5
%10 = load i64, i64* %5
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
br label %17
13: ; preds = %2
%14 = load i64, i64* %4
%15 = load i64, i64* %5
%16 = sub i64 %14, %15
br label %17
17: ; preds = %13, %12
%18 = phi i64 [ 0, %12 ], [ %16, %13 ]
ret i64 %18
}

LLVM IR (-O2):
define i64 @align_offset(i8* %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = urem i64 %3, %1
%5 = icmp eq i64 %4, 0
%6 = sub i64 %1, %4
%7 = select i1 %5, i64 0, i64 %6
ret i64 %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool I2CMasterBusBusy(uint32_t ui32Base) {
  ;
  if ((*((volatile uint32_t *)(ui32Base + 0x00000004))) & 0x00000040) {
    return (true);
  } else {
    return (false);
  }
}


x86 assembly (clang, -O0):
<I2CMasterBusBusy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1129 <I2CMasterBusBusy+0x29>
movl   $0x1,-0x4(%rbp)
jmp    1130 <I2CMasterBusBusy+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterBusBusy>:
movslq %edi,%rax
mov    0x4(%rax),%eax
shr    $0x6,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @I2CMasterBusBusy(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 4
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, 64
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @I2CMasterBusBusy(i32 %0) {
%2 = add nsw i32 %0, 4
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = lshr i32 %5, 6
%7 = and i32 %6, 1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("NO ISA 2.07 SUPPORT\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 = [21 x i8] c"NO ISA 2.07 SUPPORT\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 ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [20 x i8] c"NO ISA 2.07 SUPPORT\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ relemdata();
int /*<<< orphan*/ relemhead(char const *, int, double);
void relem(const char *name, int fp, double val) {
  if (name)
    relemhead(name, fp, val);
  else
    relemdata();
}


x86 assembly (clang, -O0):
<relem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1155 <relem+0x35>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
call   1040 <relemhead@plt>
jmp    115c <relem+0x3c>
mov    $0x0,%al
call   1030 <relemdata@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relem>:
test   %rdi,%rdi
je     112a <relem+0xa>
jmp    1040 <relemhead@plt>
xor    %eax,%eax
jmp    1030 <relemdata@plt>

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

LLVM IR (-O2):
define void @relem(i8* %0, i32 %1, double %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @relemhead(i8* %0, i32 %1, double %2)
br label %9
7: ; preds = %3
%8 = tail call i32 (...) @relemdata()
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ char_length(char const *);
size_t mbstrlen(const char *pointer) {
  size_t count = 0;
  while (*pointer != '\0') {
    pointer += char_length(pointer);
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<mbstrlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <mbstrlen+0x4e>
mov    -0x8(%rbp),%rdi
call   1030 <char_length@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <mbstrlen+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbstrlen>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     113a <mbstrlen+0x2a>
mov    %rdi,%rbx
xor    %r14d,%r14d
nop
mov    %rbx,%rdi
call   1030 <char_length@plt>
cltq
add    $0x1,%r14
cmpb   $0x0,(%rbx,%rax,1)
lea    (%rbx,%rax,1),%rbx
jne    1120 <mbstrlen+0x10>
jmp    113d <mbstrlen+0x2d>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @mbstrlen(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = tail call i32 @char_length(i8* %6)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = add i64 %5, 1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i64 [ 0, %1 ], [ %10, %4 ]
ret i64 %14
}
int mail_send() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mail_send() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int semctl(int, int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int sem_d(int semid) {
  int ret = semctl(semid, 0, IPC_RMID, 0);
  if (ret == -1)
    do {
      perror("semctl");
      exit(EXIT_FAILURE);
    } while (0);
  return ret;
}


x86 assembly (clang, -O0):
<sem_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <semctl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    117c <sem_d+0x4c>
jmp    1162 <sem_d+0x32>
lea    0xe97(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_d>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <semctl@plt>
cmp    $0xffffffff,%eax
je     114a <sem_d+0x1a>
pop    %rcx
ret
lea    0xeaf(%rip),%rdi
call   1030 <perror@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@IPC_RMID = global i32 0
@.str = [7 x i8] c"semctl\00"
@EXIT_FAILURE = global i32 0
define i32 @sem_d(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @IPC_RMID
%6 = call i32 @semctl(i32 %4, i32 0, i32 %5, i32 0)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %15
9: ; preds = %1
br label %10
10: ; preds = %9
%11 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; No predecessors!
br label %15
15: ; preds = %14, %1
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@IPC_RMID = global i32 0
@.str = [7 x i8] c"semctl\00"
@EXIT_FAILURE = global i32 0
define i32 @sem_d(i32 %0) {
%2 = load i32, i32* @IPC_RMID
%3 = tail call i32 @semctl(i32 %0, i32 0, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ f(int /*<<< orphan*/);
void testTortureExecute(void) {
  f(0);
  return;
}


x86 assembly (clang, -O0):
<testTortureExecute>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <f@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTortureExecute>:
xor    %edi,%edi
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @testTortureExecute() {
%1 = call i32 @f(i32 0)
ret void
}

LLVM IR (-O2):
define void @testTortureExecute() {
%1 = tail call i32 @f(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ unlock(char *);
quit() {
  unlock("/usr/spool/infoserv/queuelock");
  unlock("/usr/spool/infoserv/loglock");
  exit(-1);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <unlock@plt>
lea    0xee7(%rip),%rdi
call   1030 <unlock@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <unlock@plt>
lea    0xeea(%rip),%rdi
call   1030 <unlock@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"/usr/spool/infoserv/queuelock\00"
@.str.1 = [28 x i8] c"/usr/spool/infoserv/loglock\00"
define i32 @quit() {
%1 = call i32 @unlock(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @unlock(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [30 x i8] c"/usr/spool/infoserv/queuelock\00"
@.str.1 = [28 x i8] c"/usr/spool/infoserv/loglock\00"
define i32 @quit() {
%1 = tail call i32 @unlock(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @unlock(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
struct listAssoc {
  int dummy;
};

/* Variables and functions */
int size_listAssoc_aux(struct listAssoc *, int /*<<< orphan*/);
int size_listAssoc(struct listAssoc *l) { return size_listAssoc_aux(l, 0); }


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

x86 assembly (clang, -O2):
<size_listAssoc>:
xor    %esi,%esi
jmp    1030 <size_listAssoc_aux@plt>

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

LLVM IR (-O2):
%struct.listAssoc = type { i32 }
define i32 @size_listAssoc(%struct.listAssoc* %0) {
%2 = tail call i32 @size_listAssoc_aux(%struct.listAssoc* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
float powf(float, float);
float linearize_sRGB(float val) {
  if (val < 0.04045f) {
    val /= 12.92f;
  } else {
    val = powf(((val + 0.055f) / 1.055f), 2.4f);
  }
  return val;
}


x86 assembly (clang, -O0):
<linearize_sRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    114a <linearize_sRGB+0x3a>
movss  -0x4(%rbp),%xmm0
movss  0xed4(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1175 <linearize_sRGB+0x65>
movss  0xeba(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xea9(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xe99(%rip),%xmm1
call   1030 <powf@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linearize_sRGB>:
movss  0xee8(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1126 <linearize_sRGB+0x16>
divss  0xeeb(%rip),%xmm0
ret
addss  0xed6(%rip),%xmm0
divss  0xed2(%rip),%xmm0
movss  0xece(%rip),%xmm1
jmp    1030 <powf@plt>

LLVM IR (-O0):
define float @linearize_sRGB(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp olt float %3, 0x3FA4B5DCC0000000
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load float, float* %2
%7 = fdiv float %6, 0x4029D70A40000000
store float %7, float* %2
br label %13
8: ; preds = %1
%9 = load float, float* %2
%10 = fadd float %9, 0x3FAC28F5C0000000
%11 = fdiv float %10, 0x3FF0E147A0000000
%12 = call float @powf(float %11, float 0x4003333340000000)
store float %12, float* %2
br label %13
13: ; preds = %8, %5
%14 = load float, float* %2
ret float %14
}

LLVM IR (-O2):
define float @linearize_sRGB(float %0) {
%2 = fcmp olt float %0, 0x3FA4B5DCC0000000
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = fdiv float %0, 0x4029D70A40000000
br label %9
5: ; preds = %1
%6 = fadd float %0, 0x3FAC28F5C0000000
%7 = fdiv float %6, 0x3FF0E147A0000000
%8 = tail call float @powf(float %7, float 0x4003333340000000)
br label %9
9: ; preds = %5, %3
%10 = phi float [ %4, %3 ], [ %8, %5 ]
ret float %10
}
/* Type definitions */
struct genlist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_link(struct genlist const *, int);
void *genlist_link_data(int /*<<< orphan*/);
void *genlist_get(const struct genlist *pgenlist, int idx) {
  return genlist_link_data(genlist_link(pgenlist, idx));
}


x86 assembly (clang, -O0):
<genlist_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <genlist_link@plt>
mov    %eax,%edi
call   1030 <genlist_link_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genlist_get>:
push   %rax
call   1040 <genlist_link@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <genlist_link_data@plt>

LLVM IR (-O0):
%struct.genlist = type { i32 }
define i8* @genlist_get(%struct.genlist* %0, i32 %1) {
%3 = alloca %struct.genlist*
%4 = alloca i32
store %struct.genlist* %0, %struct.genlist** %3
store i32 %1, i32* %4
%5 = load %struct.genlist*, %struct.genlist** %3
%6 = load i32, i32* %4
%7 = call i32 @genlist_link(%struct.genlist* %5, i32 %6)
%8 = call i8* @genlist_link_data(i32 %7)
ret i8* %8
}

LLVM IR (-O2):
%struct.genlist = type { i32 }
define i8* @genlist_get(%struct.genlist* %0, i32 %1) {
%3 = tail call i32 @genlist_link(%struct.genlist* %0, i32 %1)
%4 = tail call i8* @genlist_link_data(i32 %3)
ret i8* %4
}
int min(int a, int b, int c) {
  if (a < b) {
    if (a < c)
      return a;
    return c;
  }
  if (b > c)
    return c;
  return b;
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <min+0x3b>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1130 <min+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min+0x58>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min+0x58>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1152 <min+0x52>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %edx,%eax
cmp    %edx,%edi
cmovl  %edi,%eax
cmp    %esi,%eax
cmovge %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %2
%5 = select i1 %4, i32 %0, i32 %2
%6 = icmp slt i32 %5, %1
%7 = select i1 %6, i32 %5, i32 %1
ret i32 %7
}
char uu_encode_char6(char in) {
  char out;
  out = (in & 0x3F) + ' ';
  if (out == ' ') {
    out = '`';
  }
  return out;
}


x86 assembly (clang, -O0):
<uu_encode_char6>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x3f,%eax
add    $0x20,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x20,%eax
jne    1128 <uu_encode_char6+0x28>
movb   $0x60,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uu_encode_char6>:
and    $0x3f,%dil
lea    0x20(%rdi),%eax
test   %dil,%dil
movzbl %al,%ecx
mov    $0x60,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @uu_encode_char6(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = and i32 %5, 63
%7 = add nsw i32 %6, 32
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 32
br i1 %11, label %12, label %13
12: ; preds = %1
store i8 96, i8* %3
br label %13
13: ; preds = %12, %1
%14 = load i8, i8* %3
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @uu_encode_char6(i8 signext %0) {
%2 = and i8 %0, 63
%3 = add nuw nsw i8 %2, 32
%4 = icmp eq i8 %2, 0
%5 = select i1 %4, i8 96, i8 %3
ret i8 %5
}
float evalQBezier1D(float e1, float e2, float c1, float t) {
  float mt, mt2;
  mt = 1 - t;
  mt2 = mt * mt;
  return (mt2 * e1) + (2 * mt * t * c1) + (t * t * e2);
}


x86 assembly (clang, -O0):
<evalQBezier1D>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  0xee4(%rip),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  0xeb5(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalQBezier1D>:
movss  0xef8(%rip),%xmm4
subss  %xmm3,%xmm4
movaps %xmm4,%xmm5
mulss  %xmm4,%xmm5
addss  %xmm4,%xmm4
mulss  %xmm3,%xmm4
mulss  %xmm2,%xmm4
mulss  %xmm5,%xmm0
addss  %xmm4,%xmm0
mulss  %xmm3,%xmm3
mulss  %xmm1,%xmm3
addss  %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @evalQBezier1D(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%11 = load float, float* %8
%12 = fsub float 1.000000e+00, %11
store float %12, float* %9
%13 = load float, float* %9
%14 = load float, float* %9
%15 = fmul float %13, %14
store float %15, float* %10
%16 = load float, float* %10
%17 = load float, float* %5
%18 = load float, float* %9
%19 = fmul float 2.000000e+00, %18
%20 = load float, float* %8
%21 = fmul float %19, %20
%22 = load float, float* %7
%23 = fmul float %21, %22
%24 = call float @llvm.fmuladd.f32(float %16, float %17, float %23)
%25 = load float, float* %8
%26 = load float, float* %8
%27 = fmul float %25, %26
%28 = load float, float* %6
%29 = call float @llvm.fmuladd.f32(float %27, float %28, float %24)
ret float %29
}

LLVM IR (-O2):
define float @evalQBezier1D(float %0, float %1, float %2, float %3) {
%5 = fsub float 1.000000e+00, %3
%6 = fmul float %5, %5
%7 = fmul float %5, 2.000000e+00
%8 = fmul float %7, %3
%9 = fmul float %8, %2
%10 = tail call float @llvm.fmuladd.f32(float %6, float %0, float %9)
%11 = fmul float %3, %3
%12 = tail call float @llvm.fmuladd.f32(float %11, float %1, float %10)
ret float %12
}
/* Variables and functions */
int /*<<< orphan*/ bubble_sort(int *, int);
int /*<<< orphan*/ calculate_pi_1(int);
int /*<<< orphan*/ calculate_pi_2(int);
int /*<<< orphan*/ generate_array(int *, int);
int /*<<< orphan*/ multiply_matrix(int);
int /*<<< orphan*/ start();
int /*<<< orphan*/ stop();
int all() {
  start();
  int array[30000];
  generate_array(array, 30000);
  bubble_sort(array, 30000);
  calculate_pi_1(10000);
  calculate_pi_2(100000);
  multiply_matrix(800);
  stop();
  return 0;
}


x86 assembly (clang, -O0):
<all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d4c0,%rsp
mov    $0x0,%al
call   1060 <start@plt>
lea    -0x1d4c0(%rbp),%rdi
mov    $0x7530,%esi
call   1070 <generate_array@plt>
lea    -0x1d4c0(%rbp),%rdi
mov    $0x7530,%esi
call   1090 <bubble_sort@plt>
mov    $0x2710,%edi
call   1080 <calculate_pi_1@plt>
mov    $0x186a0,%edi
call   1050 <calculate_pi_2@plt>
mov    $0x320,%edi
call   1030 <multiply_matrix@plt>
mov    $0x0,%al
call   1040 <stop@plt>
xor    %eax,%eax
add    $0x1d4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<all>:
push   %rbx
sub    $0x1d4c0,%rsp
xor    %eax,%eax
call   1060 <start@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7530,%esi
call   1070 <generate_array@plt>
mov    %rbx,%rdi
mov    $0x7530,%esi
call   1090 <bubble_sort@plt>
mov    $0x2710,%edi
call   1080 <calculate_pi_1@plt>
mov    $0x186a0,%edi
call   1050 <calculate_pi_2@plt>
mov    $0x320,%edi
call   1030 <multiply_matrix@plt>
xor    %eax,%eax
call   1040 <stop@plt>
xor    %eax,%eax
add    $0x1d4c0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @all() {
%1 = alloca [30000 x i32]
%2 = call i32 (...) @start()
%3 = getelementptr inbounds [30000 x i32], [30000 x i32]* %1, i64 0, i64 0
%4 = call i32 @generate_array(i32* %3, i32 30000)
%5 = getelementptr inbounds [30000 x i32], [30000 x i32]* %1, i64 0, i64 0
%6 = call i32 @bubble_sort(i32* %5, i32 30000)
%7 = call i32 @calculate_pi_1(i32 10000)
%8 = call i32 @calculate_pi_2(i32 100000)
%9 = call i32 @multiply_matrix(i32 800)
%10 = call i32 (...) @stop()
ret i32 0
}

LLVM IR (-O2):
define i32 @all() {
%1 = alloca [30000 x i32]
%2 = tail call i32 (...) @start()
%3 = bitcast [30000 x i32]* %1 to i8*
%4 = getelementptr inbounds [30000 x i32], [30000 x i32]* %1, i64 0, i64 0
%5 = call i32 @generate_array(i32* %4, i32 30000)
%6 = call i32 @bubble_sort(i32* %4, i32 30000)
%7 = call i32 @calculate_pi_1(i32 10000)
%8 = call i32 @calculate_pi_2(i32 100000)
%9 = call i32 @multiply_matrix(i32 800)
%10 = call i32 (...) @stop()
ret i32 0
}
int fun1133() { return 1133; }


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

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

LLVM IR (-O0):
define i32 @fun1133() {
ret i32 1133
}

LLVM IR (-O2):
define i32 @fun1133() {
ret i32 1133
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t Piano_In(void) {
  uint32_t input = 0;
  input = ((*((volatile uint32_t *)0x400243FC)) & 0x0F);
  return input;
}


x86 assembly (clang, -O0):
<Piano_In>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x400243fc,%eax
mov    (%rax),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Piano_In>:
mov    0x400243fc,%eax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i32 @Piano_In() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load volatile i32, i32* inttoptr (i64 1073890300 to i32*)
%3 = and i32 %2, 15
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @Piano_In() {
%1 = load volatile i32, i32* inttoptr (i64 1073890300 to i32*)
%2 = and i32 %1, 15
ret i32 %2
}
int do_571() { return 571; }


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

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

LLVM IR (-O0):
define i32 @do_571() {
ret i32 571
}

LLVM IR (-O2):
define i32 @do_571() {
ret i32 571
}
unsigned long str_hash(char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = *str++))
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <str_hash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <str_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <str_hash+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str_hash+0x10>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i64 @str_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
store i64 5381, i64* %3
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
%9 = sext i8 %8 to i32
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %5
%12 = load i64, i64* %3
%13 = shl i64 %12, 5
%14 = load i64, i64* %3
%15 = add i64 %13, %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = add i64 %15, %17
store i64 %18, i64* %3
br label %5
19: ; preds = %5
%20 = load i64, i64* %3
ret i64 %20
}

LLVM IR (-O2):
define i64 @str_hash(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 i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = sext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
unsigned short btols(unsigned short big) {
  int c = 0;
  union {
    unsigned short big;
    char bytes[sizeof(unsigned short)];
  } swapper_big;
  union {
    char bytes[sizeof(unsigned short)];
    unsigned short little;
  } swapper_little;
  swapper_big.big = big;
  for (c = 0; c < sizeof(unsigned short); c++)
    swapper_little.bytes[c] = swapper_big.bytes[sizeof(unsigned short) - c - 1];
  return (swapper_little.little);
}


x86 assembly (clang, -O0):
<btols>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x2,%rax
jae    1159 <btols+0x59>
movslq -0x8(%rbp),%rcx
mov    $0x2,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    -0x10(%rbp,%rax,1),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x18(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <btols+0x21>
movzwl -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<btols>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
%union.anon = type { i16 }
%union.anon.0 = type { i16 }
define zeroext i16 @btols(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
%4 = alloca %union.anon
%5 = alloca %union.anon.0
store i16 %0, i16* %2
store i32 0, i32* %3
%6 = load i16, i16* %2
%7 = bitcast %union.anon* %4 to i16*
store i16 %6, i16* %7
store i32 0, i32* %3
br label %8
8: ; preds = %24, %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 2
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = bitcast %union.anon* %4 to [2 x i8]*
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = sub i64 2, %15
%17 = sub i64 %16, 1
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %13, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = bitcast %union.anon.0* %5 to [2 x i8]*
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %20, i64 0, i64 %22
store i8 %19, i8* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %8
27: ; preds = %8
%28 = bitcast %union.anon.0* %5 to i16*
%29 = load i16, i16* %28
ret i16 %29
}

LLVM IR (-O2):
define zeroext i16 @btols(i16 zeroext %0) {
%2 = call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
char param_getchar_indx(char const *, int /*<<< orphan*/, int);
char param_getchar(const char *line, int paramnum) {
  return param_getchar_indx(line, 0, paramnum);
}


x86 assembly (clang, -O0):
<param_getchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <param_getchar_indx@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_getchar>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <param_getchar_indx@plt>

LLVM IR (-O0):
define signext i8 @param_getchar(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call signext i8 @param_getchar_indx(i8* %5, i32 0, i32 %6)
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @param_getchar(i8* %0, i32 %1) {
%3 = tail call signext i8 @param_getchar_indx(i8* %0, i32 0, i32 %1)
ret i8 %3
}
int c_command(wp)
char **wp;
{ return c_whence(wp); }


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

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

LLVM IR (-O0):
define i32 @c_command(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = call i32 (i8**, ...) bitcast (i32 (...)* @c_whence to i32 (i8**, ...)*)(i8** %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @c_command(i8** %0) {
%2 = tail call i32 (i8**, ...) bitcast (i32 (...)* @c_whence to i32 (i8**, ...)*)(i8** %0)
ret i32 %2
}
int f2(int a, int b) { return (b | a) ^ b; }


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

x86 assembly (clang, -O2):
<f2>:
mov    %esi,%eax
not    %eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f2(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free1(int *);
void free1int(int *p) { free1(p); }


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

x86 assembly (clang, -O2):
<free1int>:
jmp    1030 <free1@plt>

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

LLVM IR (-O2):
define void @free1int(i32* %0) {
%2 = tail call i32 @free1(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ reset();
int /*<<< orphan*/ store();
void sig_hup(int s) {
  reset();
  store();
}


x86 assembly (clang, -O0):
<sig_hup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <reset@plt>
mov    $0x0,%al
call   1030 <store@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @sig_hup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @reset()
%4 = call i32 (...) @store()
ret void
}

LLVM IR (-O2):
define void @sig_hup(i32 %0) {
%2 = tail call i32 (...) @reset()
%3 = tail call i32 (...) @store()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void erase(void) {
  int i;
  fputc('\r', stdout);
  for (i = 0; i < 80; i++)
    fputc(' ', stdout);
  fputc('\r', stdout);
}


x86 assembly (clang, -O0):
<erase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x50,-0x4(%rbp)
jge    115d <erase+0x4d>
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1030 <fputc@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <erase+0x22>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erase>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%esi
mov    $0xd,%edi
call   1030 <fputc@plt>
mov    $0x50,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    $0x20,%edi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jne    1130 <erase+0x20>
mov    (%rbx),%esi
mov    $0xd,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @erase() {
%1 = alloca i32
%2 = load i32, i32* @stdout
%3 = call i32 @fputc(i8 signext 13, i32 %2)
store i32 0, i32* %1
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 80
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* @stdout
%9 = call i32 @fputc(i8 signext 32, i32 %8)
br label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %4
13: ; preds = %4
%14 = load i32, i32* @stdout
%15 = call i32 @fputc(i8 signext 13, i32 %14)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @erase() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputc(i8 signext 13, i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %7, %3 ]
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputc(i8 signext 32, i32 %5)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 80
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = load i32, i32* @stdout
%11 = tail call i32 @fputc(i8 signext 13, i32 %10)
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double get_time() {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec + tv.tv_usec / 1000000.0;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xecb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @get_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %4, %7
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t ReadLE32(const unsigned char *ptr) { return *((uint32_t *)ptr); }


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

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

LLVM IR (-O0):
define i32 @ReadLE32(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @ReadLE32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int test_imm_34int16_mem(short *val) {
  return ((*val) & (-0x34 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_34int16_mem>:
movzwl (%rdi),%eax
test   $0xffcc,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_34int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -52
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int char2byte(char);
char *strtok(int /*<<< orphan*/ *, char *);
unsigned short parse_SKNP() {
  unsigned short instruction = 0xE0A1;
  char *arg;
  arg = strtok(NULL, " ,");
  if (arg[0] != 'V') {
    return 0xFFFF;
  }
  instruction |= (char2byte(arg[1])) << 8;
  return instruction;
}


x86 assembly (clang, -O0):
<parse_SKNP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0xe0a1,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xec7(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x56,%eax
je     115d <parse_SKNP+0x3d>
movw   $0xffff,-0x2(%rbp)
jmp    1181 <parse_SKNP+0x61>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <char2byte@plt>
mov    %eax,%ecx
shl    $0x8,%ecx
movzwl -0x4(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_SKNP>:
push   %rax
lea    0xed8(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
mov    %rax,%rcx
mov    $0xffff,%ax
cmpb   $0x56,(%rcx)
jne    114c <parse_SKNP+0x2c>
movsbl 0x1(%rcx),%edi
call   1030 <char2byte@plt>
shl    $0x8,%eax
or     $0xe0a1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c" ,\00"
define zeroext i16 @parse_SKNP() {
%1 = alloca i16
%2 = alloca i16
%3 = alloca i8*
store i16 -8031, i16* %2
%4 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 86
br i1 %9, label %10, label %11
10: ; preds = %0
store i16 -1, i16* %1
br label %22
11: ; preds = %0
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = call i32 @char2byte(i8 signext %14)
%16 = shl i32 %15, 8
%17 = load i16, i16* %2
%18 = zext i16 %17 to i32
%19 = or i32 %18, %16
%20 = trunc i32 %19 to i16
store i16 %20, i16* %2
%21 = load i16, i16* %2
store i16 %21, i16* %1
br label %22
22: ; preds = %11, %10
%23 = load i16, i16* %1
ret i16 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c" ,\00"
define zeroext i16 @parse_SKNP() {
%1 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = load i8, i8* %1
%3 = icmp eq i8 %2, 86
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @char2byte(i8 signext %6)
%8 = trunc i32 %7 to i16
%9 = shl i16 %8, 8
%10 = or i16 %9, -8031
br label %11
11: ; preds = %0, %4
%12 = phi i16 [ %10, %4 ], [ -1, %0 ]
ret i16 %12
}
/* Type definitions */
typedef int uint8_t;
typedef size_t uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printMemory(uint32_t memsize, uint8_t *memptr) {
  for (uint32_t cntr = 0; cntr < memsize; ++cntr) {
    printf("%02X", memptr[cntr]);
  }
}


x86 assembly (clang, -O0):
<printMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    115e <printMemory+0x4e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <printMemory+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMemory>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1145 <printMemory+0x35>
mov    %rsi,%r14
mov    %rdi,%r12
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printMemory+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%02X\00"
define void @printMemory(i64 %0, i32* nocapture %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %0
br i1 %11, label %4, label %5
}
int fesetexcept(int excepts) { return (excepts != 0); }


x86 assembly (clang, -O0):
<fesetexcept>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fesetexcept>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @fesetexcept(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @fesetexcept(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}