xunge/DecIR huggingface dataset:
char *skip(bp)
register char *bp;
{
  while (*bp && *bp != ':')
    bp++;
  if (*bp == ':')
    bp++;
  return (bp);
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112d <skip+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <skip+0x3d>
jmp    114e <skip+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip+0x8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    116a <skip+0x6a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1122 <skip+0x22>
cmp    $0x3a,%cl
je     1122 <skip+0x22>
add    $0x1,%rax
jmp    1110 <skip+0x10>
xor    %edx,%edx
cmp    $0x3a,%cl
sete   %dl
add    %rdx,%rax
ret

LLVM IR (-O0):
define i8* @skip(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %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 %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 58
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 58
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
br label %26
26: ; preds = %23, %18
%27 = load i8*, i8** %2
ret i8* %27
}

LLVM IR (-O2):
define i8* @skip(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 58, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
%8 = icmp eq i8 %4, 58
%9 = zext i1 %8 to i64
%10 = getelementptr i8, i8* %3, i64 %9
ret i8* %10
}
/* Variables and functions */
scalar_t__ malloc(int);
void v_zeros(void **ptrA, int size) {
  *ptrA = (void *)malloc(size);
  char *A = *ptrA;
  int i;
  for (i = 0; i < size; i++)
    A[i] = 0;
}


x86 assembly (clang, -O0):
<v_zeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <v_zeros+0x59>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1143 <v_zeros+0x33>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_zeros>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <malloc@plt>
mov    %rax,(%r14)
test   %ebx,%ebx
jle    1143 <v_zeros+0x23>
mov    %ebx,%edx
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @v_zeros(i8** nocapture writeonly %0, i32 %1) {
%3 = tail call i64 @malloc(i32 %1)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %0
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %2
ret void
}
void ABGRToAR30Row_C() {}


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

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

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

LLVM IR (-O2):
define void @ABGRToAR30Row_C() {
ret void
}
/* Variables and functions */
unsigned short smi_read(unsigned short, unsigned short);
unsigned short smi_port_read(unsigned short phyaddr, unsigned short regnum) {
  return smi_read(phyaddr, regnum);
}


x86 assembly (clang, -O0):
<smi_port_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzwl -0x4(%rbp),%esi
call   1030 <smi_read@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smi_port_read>:
jmp    1030 <smi_read@plt>

LLVM IR (-O0):
define zeroext i16 @smi_port_read(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = load i16, i16* %4
%7 = call zeroext i16 @smi_read(i16 zeroext %5, i16 zeroext %6)
ret i16 %7
}

LLVM IR (-O2):
define zeroext i16 @smi_port_read(i16 zeroext %0, i16 zeroext %1) {
%3 = tail call zeroext i16 @smi_read(i16 zeroext %0, i16 zeroext %1)
ret i16 %3
}
long long foo6(long long x) { return x + (-1); }


x86 assembly (clang, -O0):
<foo6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo6>:
lea    -0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @foo6(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, -1
ret i64 %4
}

LLVM IR (-O2):
define i64 @foo6(i64 %0) {
%2 = add nsw i64 %0, -1
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ run();
int main() {
  initscr();
  noecho();
  cbreak();
  run();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1070 <noecho@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    $0x0,%al
call   1040 <run@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1070 <noecho@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
xor    %eax,%eax
call   1040 <run@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @noecho()
%4 = call i32 (...) @cbreak()
%5 = call i32 (...) @run()
%6 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @noecho()
%3 = tail call i32 (...) @cbreak()
%4 = tail call i32 (...) @run()
%5 = tail call i32 (...) @endwin()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int gen_TERM() { kill(getpid(), SIGTERM); }


x86 assembly (clang, -O0):
<gen_TERM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_TERM>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
pop    %rax
jmp    1040 <kill@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
define i32 @gen_TERM() {
%1 = alloca i32
%2 = call i32 (...) @getpid()
%3 = load i32, i32* @SIGTERM
%4 = call i32 @kill(i32 %2, i32 %3)
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define i32 @gen_TERM() {
%1 = tail call i32 (...) @getpid()
%2 = load i32, i32* @SIGTERM
%3 = tail call i32 @kill(i32 %1, i32 %2)
ret i32 undef
}
int parseInt(char *str) {
  int res = 0;
  for (int i = 0; str[i] != '\0'; ++i) {
    res = res * 10 + str[i] - '0';
  }
  return res;
}


x86 assembly (clang, -O0):
<parseInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <parseInt+0x51>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <parseInt+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseInt>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <parseInt+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <parseInt+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @parseInt(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %5
6: ; preds = %1, %6
%7 = phi i64 [ %14, %6 ], [ 0, %1 ]
%8 = phi i8 [ %16, %6 ], [ %2, %1 ]
%9 = phi i32 [ %13, %6 ], [ 0, %1 ]
%10 = sext i8 %8 to i32
%11 = mul nsw i32 %9, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %10
%14 = add nuw nsw i64 %7, 1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %4, label %6
}
/* Variables and functions */
int /*<<< orphan*/ flush_cache();
int /*<<< orphan*/ flush_cores();
int /*<<< orphan*/ flush_hashtable();
void flush_all() {
  flush_hashtable();
  flush_cache();
  flush_cores();
}


x86 assembly (clang, -O0):
<flush_all>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <flush_hashtable@plt>
mov    $0x0,%al
call   1050 <flush_cache@plt>
mov    $0x0,%al
call   1040 <flush_cores@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_all>:
push   %rax
xor    %eax,%eax
call   1030 <flush_hashtable@plt>
xor    %eax,%eax
call   1050 <flush_cache@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <flush_cores@plt>

LLVM IR (-O0):
define void @flush_all() {
%1 = call i32 (...) @flush_hashtable()
%2 = call i32 (...) @flush_cache()
%3 = call i32 (...) @flush_cores()
ret void
}

LLVM IR (-O2):
define void @flush_all() {
%1 = tail call i32 (...) @flush_hashtable()
%2 = tail call i32 (...) @flush_cache()
%3 = tail call i32 (...) @flush_cores()
ret void
}
void bochs_break() { __asm__ __volatile__("xchg %bx, %bx"); }


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

x86 assembly (clang, -O2):
<bochs_break>:
xchg   %bx,%bx
ret

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

LLVM IR (-O2):
define void @bochs_break() {
tail call void asm sideeffect "xchg %bx, %bx", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int O_CREAT;
int O_TRUNC;
int O_WRONLY;
void *doOpen(char const *, int);
void *__PHYSFS_platformOpenWrite(const char *filename) {
  return doOpen(filename, O_WRONLY | O_CREAT | O_TRUNC);
}


x86 assembly (clang, -O0):
<__PHYSFS_platformOpenWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    0x2ec8(%rip),%rax
or     (%rax),%esi
mov    0x2eb7(%rip),%rax
or     (%rax),%esi
call   1030 <doOpen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__PHYSFS_platformOpenWrite>:
mov    0x2eb1(%rip),%rax
mov    0x2eda(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2ec7(%rip),%rax
or     (%rax),%esi
jmp    1030 <doOpen@plt>

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i8* @__PHYSFS_platformOpenWrite(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_WRONLY
%5 = load i32, i32* @O_CREAT
%6 = or i32 %4, %5
%7 = load i32, i32* @O_TRUNC
%8 = or i32 %6, %7
%9 = call i8* @doOpen(i8* %3, i32 %8)
ret i8* %9
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i8* @__PHYSFS_platformOpenWrite(i8* %0) {
%2 = load i32, i32* @O_WRONLY
%3 = load i32, i32* @O_CREAT
%4 = or i32 %3, %2
%5 = load i32, i32* @O_TRUNC
%6 = or i32 %4, %5
%7 = tail call i8* @doOpen(i8* %0, i32 %6)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ x;
int fun(int a) {
  a = a + 5;
  printf("int: %20d\n", a);
  const x;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
lea    0x5(%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"int: %20d\0A\00"
@x = global i32 0
define i32 @fun(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@.str = [11 x i8] c"int: %20d\0A\00"
@x = global i32 0
define i32 @fun(i32 %0) {
%2 = add nsw i32 %0, 5
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 undef
}
unsigned fff(unsigned a) { return a & 0xff00000u; }


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

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

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

LLVM IR (-O2):
define i32 @fff(i32 %0) {
%2 = and i32 %0, 267386880
ret i32 %2
}
int findgcd(int x, int y) {
  while (x != y) {
    if (x > y)
      return findgcd(x - y, y);
    else
      return findgcd(x, y - x);
  }
  return x;
}


x86 assembly (clang, -O0):
<findgcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1162 <findgcd+0x52>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    114c <findgcd+0x3c>
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <findgcd@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <findgcd+0x58>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
call   1030 <findgcd@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <findgcd+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findgcd>:
cmp    %esi,%edi
jne    1107 <findgcd+0x7>
mov    %edi,%eax
ret
mov    %esi,%eax
mov    %eax,%ecx
nopl   0x0(%rax,%rax,1)
sub    %edi,%ecx
jl     1120 <findgcd+0x20>
mov    %ecx,%eax
cmp    %ecx,%edi
jne    1110 <findgcd+0x10>
jmp    1104 <findgcd+0x4>
nopl   0x0(%rax)
sub    %eax,%edi
cmp    %edi,%eax
jne    1109 <findgcd+0x9>
jmp    1106 <findgcd+0x6>

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

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

/* Variables and functions */
int /*<<< orphan*/ glXGetProcAddress(int /*<<< orphan*/ const *);
__attribute__((visibility("default"))) __GLXextFuncPtr
glXGetProcAddressARB(const GLubyte *func) {
  return (void (*)(void))glXGetProcAddress(func);
}


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

x86 assembly (clang, -O2):
<glXGetProcAddressARB>:
push   %rax
call   1030 <glXGetProcAddress@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define void (...)* @glXGetProcAddressARB(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @glXGetProcAddress(i32* %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to void ()*
%7 = bitcast void ()* %6 to void (...)*
ret void (...)* %7
}

LLVM IR (-O2):
define void (...)* @glXGetProcAddressARB(i32* %0) {
%2 = tail call i32 @glXGetProcAddress(i32* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to void (...)*
ret void (...)* %4
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_spifunc5a(void) { return GppcFinfoV1(); }


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

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

LLVM IR (-O0):
define i8* @pg_finfo_spifunc5a() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_spifunc5a() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
/* Type definitions */
struct bladerf {
  int dummy;
};

/* Variables and functions */
int flash_erase(struct bladerf *, int, int);
int flash_erase_fpga(struct bladerf *dev) {
  return flash_erase(dev, (((0x00040000) / (64 * 1024))),
                     (((0x00370000) / (64 * 1024))));
}


x86 assembly (clang, -O0):
<flash_erase_fpga>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
mov    $0x37,%edx
call   1030 <flash_erase@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flash_erase_fpga>:
mov    $0x4,%esi
mov    $0x37,%edx
jmp    1030 <flash_erase@plt>

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

LLVM IR (-O2):
%struct.bladerf = type { i32 }
define i32 @flash_erase_fpga(%struct.bladerf* %0) {
%2 = tail call i32 @flash_erase(%struct.bladerf* %0, i32 4, i32 55)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ powerset(int *, int, int /*<<< orphan*/, int *,
                            int /*<<< orphan*/);
void main() {
  int a[] = {1, 2, 3};
  int len = sizeof(a) / sizeof(a[0]);
  int p[len];
  powerset(a, len, 0, p, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xeea(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
xor    %r8d,%r8d
mov    %r8d,%edx
call   1030 <powerset@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    0xeea(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xed7(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
lea    0x10(%rsp),%rcx
mov    $0x3,%esi
xor    %edx,%edx
xor    %r8d,%r8d
call   1030 <powerset@plt>
mov    %rbx,%rsp
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [3 x i32] [i32 1, i32 2, i32 3]
define void @main() {
%1 = alloca [3 x i32]
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast [3 x i32]* %1 to i8*
store i32 3, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i32, i64 %7
store i64 %7, i64* %4
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%11 = load i32, i32* %2
%12 = call i32 @powerset(i32* %10, i32 %11, i32 0, i32* %9, i32 0)
%13 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@__const.main.a = [3 x i32] [i32 1, i32 2, i32 3]
define void @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [3 x i32]
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%7 = call i32 @powerset(i32* %6, i32 3, i32 0, i32* %5, i32 0)
ret void
}
void semihost_disable(void) {}


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

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

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

LLVM IR (-O2):
define void @semihost_disable() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int initialize_quaddobl_sampler(int dim) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc(662, &dim, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<initialize_quaddobl_sampler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x296,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_quaddobl_sampler>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x296,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @initialize_quaddobl_sampler(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %3
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc(i32 662, i32* %2, i32* %6, double* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @initialize_quaddobl_sampler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc(i32 662, i32* %2, i32* undef, double* undef)
ret i32 %3
}
/* Variables and functions */
double fabs(double);
double rel_err(double expected, double actual) {
  return fabs((expected - actual) / expected);
}


x86 assembly (clang, -O0):
<rel_err>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movaps 0xedc(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rel_err>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
andpd  0xeec(%rip),%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @rel_err(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = load double, double* %3
%9 = fdiv double %7, %8
%10 = call double @llvm.fabs.f64(double %9)
ret double %10
}

LLVM IR (-O2):
define double @rel_err(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fdiv double %3, %0
%5 = tail call double @llvm.fabs.f64(double %4)
ret double %5
}
unsigned char LPCByteRead(unsigned long ulBase, unsigned long ulOffset) {
  ;

  ;
  return ((*((volatile unsigned char *)(ulBase + 0x00000400 + ulOffset))));
}


x86 assembly (clang, -O0):
<LPCByteRead>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x400,%rax
add    -0x10(%rbp),%rax
mov    (%rax),%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCByteRead>:
mov    0x400(%rdi,%rsi,1),%al
ret

LLVM IR (-O0):
define zeroext i8 @LPCByteRead(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 1024
%7 = load i64, i64* %4
%8 = add i64 %6, %7
%9 = inttoptr i64 %8 to i8*
%10 = load volatile i8, i8* %9
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @LPCByteRead(i64 %0, i64 %1) {
%3 = add i64 %0, 1024
%4 = add i64 %3, %1
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
ret i8 %6
}
void Array_quick_sort(int *arr, int len) {
  assert(arr);
  assert(len > 0);
  quicksort(arr, 0, len - 1);
}


x86 assembly (clang, -O0):
<Array_quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <assert@plt>
cmpl   $0x0,-0xc(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x0,%al
call   1030 <quicksort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Array_quick_sort>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <assert@plt>
xor    %edi,%edi
test   %ebx,%ebx
setg   %dil
xor    %eax,%eax
call   1040 <assert@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <quicksort@plt>

LLVM IR (-O0):
define void @Array_quick_sort(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 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %5)
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %9)
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @quicksort to i32 (i32*, i32, i32, ...)*)(i32* %11, i32 0, i32 %13)
ret void
}

LLVM IR (-O2):
define void @Array_quick_sort(i32* %0, i32 %1) {
%3 = tail call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %0)
%4 = icmp sgt i32 %1, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %5)
%7 = add nsw i32 %1, -1
%8 = tail call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @quicksort to i32 (i32*, i32, i32, ...)*)(i32* %0, i32 0, i32 %7)
ret void
}
f(got) {
  if (got != 0xffff)
    abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0xffff,-0x8(%rbp)
je     112d <f+0x1d>
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0xffff,%edi
jne    1119 <f+0x9>
ret
push   %rax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp eq i32 %0, 65535
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int /*<<< orphan*/ *fopen(char *, char *);
FILE *sca_fopen(char *file, char *mode) {
  FILE *fptr;
  do {
    fptr = fopen(file, mode);
  } while (errno == EINTR);
  return fptr;
}


x86 assembly (clang, -O0):
<sca_fopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%rax
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%rax
je     1120 <sca_fopen+0x10>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sca_fopen>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2ebb(%rip),%r15
mov    0x2eac(%rip),%r12
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fopen@plt>
mov    (%r15),%rcx
cmp    (%r12),%rcx
je     1130 <sca_fopen+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32* @sca_fopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %10, %2
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %7, i8* %8)
store i32* %9, i32** %5
br label %10
10: ; preds = %6
%11 = load i64, i64* @errno
%12 = load i64, i64* @EINTR
%13 = icmp eq i64 %11, %12
br i1 %13, label %6, label %14
14: ; preds = %10
%15 = load i32*, i32** %5
ret i32* %15
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define noalias i32* @sca_fopen(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32* @fopen(i8* %0, i8* %1)
%5 = load i64, i64* @errno
%6 = load i64, i64* @EINTR
%7 = icmp eq i64 %5, %6
br i1 %7, label %3, label %8
8: ; preds = %3
ret i32* %4
}
adrreg0adrreg1_set(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (p0[10000000]) = (p1[1111111 / 4]); }


x86 assembly (clang, -O0):
<adrreg0adrreg1_set>:
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    -0x20(%rbp),%rax
mov    0x87a22(%rax),%cx
mov    -0x18(%rbp),%rax
mov    %cx,0x1312d00(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0adrreg1_set>:
movzwl 0x87a22(%r9),%eax
mov    %ax,0x1312d00(%r8)
01
ret

LLVM IR (-O0):
define i32 @adrreg0adrreg1_set(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** %13
%17 = getelementptr inbounds i16, i16* %16, i64 277777
%18 = load i16, i16* %17
%19 = load i16*, i16** %12
%20 = getelementptr inbounds i16, i16* %19, i64 10000000
store i16 %18, i16* %20
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @adrreg0adrreg1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture %5) {
%7 = getelementptr inbounds i16, i16* %5, i64 277777
%8 = load i16, i16* %7
%9 = getelementptr inbounds i16, i16* %4, i64 10000000
store i16 %8, i16* %9
ret i32 undef
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, void *);
unsigned long up_getwalltime(void) {
  struct timeval tm;
  (void)gettimeofday(&tm, (void *)0);
  return tm.tv_sec * 1000 + tm.tv_usec / 1000;
}


x86 assembly (clang, -O0):
<up_getwalltime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<up_getwalltime>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @up_getwalltime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i8* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @up_getwalltime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i8* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
%11 = sext i32 %10 to i64
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
unsigned long EPIIntErrorStatus(unsigned long ulBase) {
  DEBUG_ASSERT(ulBase == 0x400D0000);
  return ((*((volatile unsigned long *)(ulBase + 0x0000021C))));
}


x86 assembly (clang, -O0):
<EPIIntErrorStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x400d0000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x21c(%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPIIntErrorStatus>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x400d0000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    0x21c(%rbx),%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @EPIIntErrorStatus(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 1074593792
%5 = zext i1 %4 to i32
%6 = call i32 @DEBUG_ASSERT(i32 %5)
%7 = load i64, i64* %2
%8 = add i64 %7, 540
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @EPIIntErrorStatus(i64 %0) {
%2 = icmp eq i64 %0, 1074593792
%3 = zext i1 %2 to i32
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = add i64 %0, 540
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
ret i64 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ closeFile(int /*<<< orphan*/ *);
int /*<<< orphan*/ *openFile(char *);
int /*<<< orphan*/ readFile(int /*<<< orphan*/ *);
int main() {
  FILE *fp = openFile(".\\test1.txt");
  readFile(fp);
  closeFile(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <openFile@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <readFile@plt>
mov    -0x10(%rbp),%rdi
call   1040 <closeFile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <openFile@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <readFile@plt>
mov    %rbx,%rdi
call   1040 <closeFile@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c".\\test1.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @openFile(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @readFile(i32* %4)
%6 = load i32*, i32** %2
%7 = call i32 @closeFile(i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c".\\test1.txt\00"
define i32 @main() {
%1 = tail call i32* @openFile(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @readFile(i32* %1)
%3 = tail call i32 @closeFile(i32* %1)
ret i32 0
}
/* Variables and functions */
float sineIn(int, float, float);
float sineOut(float fraction, float start, float delta) {
  return sineIn(1 - fraction, start + delta, -delta);
}


x86 assembly (clang, -O0):
<sineOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xed1(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
call   1030 <sineIn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sineOut>:
movss  0xee8(%rip),%xmm3
subss  %xmm0,%xmm3
cvttss2si %xmm3,%edi
movaps %xmm1,%xmm0
addss  %xmm2,%xmm0
xorps  0xee2(%rip),%xmm2
movaps %xmm2,%xmm1
jmp    1030 <sineIn@plt>

LLVM IR (-O0):
define float @sineOut(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = fsub float 1.000000e+00, %7
%9 = fptosi float %8 to i32
%10 = load float, float* %5
%11 = load float, float* %6
%12 = fadd float %10, %11
%13 = load float, float* %6
%14 = fneg float %13
%15 = call float @sineIn(i32 %9, float %12, float %14)
ret float %15
}

LLVM IR (-O2):
define float @sineOut(float %0, float %1, float %2) {
%4 = fsub float 1.000000e+00, %0
%5 = fptosi float %4 to i32
%6 = fadd float %1, %2
%7 = fneg float %2
%8 = tail call float @sineIn(i32 %5, float %6, float %7)
ret float %8
}
extern int IsAlpha(char c) {
  if (c >= 'A' && c <= 'Z')
    return c;
  if (c >= 'a' && c <= 'Z')
    return c - ('a' - 'A');
  return 0;
}


x86 assembly (clang, -O0):
<IsAlpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1130 <IsAlpha+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1130 <IsAlpha+0x30>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <IsAlpha+0x60>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1159 <IsAlpha+0x59>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1159 <IsAlpha+0x59>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <IsAlpha+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsAlpha>:
lea    -0x41(%rdi),%eax
xor    %ecx,%ecx
cmp    $0x1a,%al
cmovb  %edi,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @IsAlpha(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
store i32 %13, i32* %2
br label %27
14: ; preds = %7, %1
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 97
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 90
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 32
store i32 %25, i32* %2
br label %27
26: ; preds = %18, %14
store i32 0, i32* %2
br label %27
27: ; preds = %26, %22, %11
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @IsAlpha(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = select i1 %3, i8 %0, i8 0
%5 = zext i8 %4 to i32
ret i32 %5
}
/* Variables and functions */
int bar2();
bool foo2() { return bar2(); }


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

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

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

LLVM IR (-O2):
define i32 @foo2() {
%1 = tail call i32 (...) @bar2()
ret i32 %1
}
/* Variables and functions */
int lowestTriangle(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int base;
  int area;
  scanf("%d %d", &base, &area);
  int height = lowestTriangle(base, area);
  printf("%d\n", height);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <lowestTriangle@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @lowestTriangle(i32 %6, i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @lowestTriangle(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_PROCESS_CPUTIME_ID;
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ printf(char *);
void twatch_start_cpu_time(struct timespec *start) {
  if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, start) != 0) {
    printf("gettime failed\n");
  }
}


x86 assembly (clang, -O0):
<twatch_start_cpu_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0x0,%rax
je     1154 <twatch_start_cpu_time+0x34>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twatch_start_cpu_time>:
push   %rax
mov    %rdi,%rsi
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1040 <clock_gettime@plt>
test   %rax,%rax
je     1144 <twatch_start_cpu_time+0x24>
lea    0xec2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@.str = [16 x i8] c"gettime failed\0A\00"
define void @twatch_start_cpu_time(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i64 @clock_gettime(i32 %3, %struct.timespec* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@str = [15 x i8] c"gettime failed\00"
define void @twatch_start_cpu_time(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%3 = tail call i64 @clock_gettime(i32 %2, %struct.timespec* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}
/* Type definitions */
struct MPSegment {
  int dummy;
};

/* Variables and functions */
struct MPSegment *NewMPSegment(char const *, char const *);
struct MPSegment *mp_engine(const char *dict_path, const char *user_path) {
  return NewMPSegment(dict_path, user_path);
}


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

x86 assembly (clang, -O2):
<mp_engine>:
jmp    1030 <NewMPSegment@plt>

LLVM IR (-O0):
%struct.MPSegment = type { i32 }
define %struct.MPSegment* @mp_engine(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
%7 = call %struct.MPSegment* @NewMPSegment(i8* %5, i8* %6)
ret %struct.MPSegment* %7
}

LLVM IR (-O2):
%struct.MPSegment = type { i32 }
define %struct.MPSegment* @mp_engine(i8* %0, i8* %1) {
%3 = tail call %struct.MPSegment* @NewMPSegment(i8* %0, i8* %1)
ret %struct.MPSegment* %3
}