xunge/DecIR huggingface dataset:
/* Type definitions */
struct ListNode {
  int dummy;
};
typedef int /*<<< orphan*/ A;

/* Variables and functions */
struct ListNode *createList(int *, int);
struct ListNode *swapPairs(struct ListNode *);
int main(int argc, char **argv) {
  int A[] = {1, 3, 5, 7, 9};
  struct ListNode *la = createList(A, sizeof(A) / sizeof(int));
  struct ListNode *result = swapPairs(la);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1040 <createList@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <swapPairs@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <createList@plt>
mov    %rax,%rdi
call   1030 <swapPairs@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@__const.main.A = [5 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca %struct.ListNode*
%8 = alloca %struct.ListNode*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [5 x i32]* %6 to i8*
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%11 = call %struct.ListNode* @createList(i32* %10, i32 5)
store %struct.ListNode* %11, %struct.ListNode** %7
%12 = load %struct.ListNode*, %struct.ListNode** %7
%13 = call %struct.ListNode* @swapPairs(%struct.ListNode* %12)
store %struct.ListNode* %13, %struct.ListNode** %8
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
@__const.main.A = [5 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%6 = call %struct.ListNode* @createList(i32* %5, i32 5)
%7 = call %struct.ListNode* @swapPairs(%struct.ListNode* %6)
ret i32 0
}
double KMtoIN(double KM) { return KM * 39370.0787; }


x86 assembly (clang, -O0):
<KMtoIN>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @KMtoIN(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x40E3394284B5DCC6
ret double %4
}

LLVM IR (-O2):
define double @KMtoIN(double %0) {
%2 = fmul double %0, 0x40E3394284B5DCC6
ret double %2
}
int __test_and_clear_bit(long nr, volatile unsigned long *addr) {
  int oldbit;
  asm volatile("btr %2,%1\n\t"
               "sbb %0,%0"
               : "=r"(oldbit), "+m"((*(volatile long *)addr))
               : "Ir"(nr));
  return oldbit;
}


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

x86 assembly (clang, -O2):
<__test_and_clear_bit>:
btr    %rdi,(%rsi)
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @__test_and_clear_bit(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
%5 = alloca i32
store i64 %0, i64* %3
store i64* %1, i64** %4
%6 = load i64*, i64** %4
%7 = load i64, i64* %3
%8 = call i32 asm sideeffect "btr $2,$1\0A\09sbb $0,$0", "=r,=*m,Ir,*m,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %6, i64 %7, i64* elementtype(i64) %6)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @__test_and_clear_bit(i64 %0, i64* %1) {
%3 = tail call i32 asm sideeffect "btr $2,$1\0A\09sbb $0,$0", "=r,=*m,Ir,*m,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i64 %0, i64* elementtype(i64) %1)
ret i32 %3
}
/* Variables and functions */
int get_lockname(char *, char *);
int /*<<< orphan*/ unlink(char *);
void unlock_tty(char *name) {
  char lockname[256];
  if (get_lockname(name, lockname) != -1)
    unlink(lockname);
}


x86 assembly (clang, -O0):
<unlock_tty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1040 <get_lockname@plt>
cmp    $0xffffffff,%eax
je     1154 <unlock_tty+0x34>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlock_tty>:
sub    $0x108,%rsp
mov    %rsp,%rsi
call   1040 <get_lockname@plt>
cmp    $0xffffffff,%eax
je     113c <unlock_tty+0x1c>
mov    %rsp,%rdi
call   1030 <unlink@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
define void @unlock_tty(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @get_lockname(i8* %4, i8* %5)
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = call i32 @unlink(i8* %9)
br label %11
11: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @unlock_tty(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @get_lockname(i8* %0, i8* %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @unlink(i8* %3)
br label %8
8: ; preds = %6, %1
ret void
}
/* Type definitions */
struct gengetopt_args_info {
  int dummy;
};

/* Variables and functions */
int cmdline_parser_string2(char const *, struct gengetopt_args_info *,
                           char const *, int /*<<< orphan*/, int, int);
int cmdline_parser_string(const char *cmdline,
                          struct gengetopt_args_info *args_info,
                          const char *prog_name) {
  return cmdline_parser_string2(cmdline, args_info, prog_name, 0, 1, 1);
}


x86 assembly (clang, -O0):
<cmdline_parser_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
call   1030 <cmdline_parser_string2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_parser_string>:
xor    %ecx,%ecx
mov    $0x1,%r8d
mov    $0x1,%r9d
jmp    1030 <cmdline_parser_string2@plt>

LLVM IR (-O0):
%struct.gengetopt_args_info = type { i32 }
define i32 @cmdline_parser_string(i8* %0, %struct.gengetopt_args_info* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.gengetopt_args_info*
%6 = alloca i8*
store i8* %0, i8** %4
store %struct.gengetopt_args_info* %1, %struct.gengetopt_args_info** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load %struct.gengetopt_args_info*, %struct.gengetopt_args_info** %5
%9 = load i8*, i8** %6
%10 = call i32 @cmdline_parser_string2(i8* %7, %struct.gengetopt_args_info* %8, i8* %9, i32 0, i32 1, i32 1)
ret i32 %10
}

LLVM IR (-O2):
%struct.gengetopt_args_info = type { i32 }
define i32 @cmdline_parser_string(i8* %0, %struct.gengetopt_args_info* %1, i8* %2) {
%4 = tail call i32 @cmdline_parser_string2(i8* %0, %struct.gengetopt_args_info* %1, i8* %2, i32 0, i32 1, i32 1)
ret i32 %4
}
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
  int tv_usec;
};

/* Variables and functions */
unsigned int getpid();
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int get_seed() {
  struct timeval time;
  gettimeofday(&time, NULL);
  unsigned pid = getpid();
  int seed = (time.tv_sec + pid) * 1000 + time.tv_usec / 1000;
  return seed;
}


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

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

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @get_seed() {
%1 = alloca %struct.timeval
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%5 = call i32 (...) @getpid()
store i32 %5, i32* %2
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load i32, i32* %2
%9 = add i32 %7, %8
%10 = mul i32 %9, 1000
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%12 = load i32, i32* %11
%13 = sdiv i32 %12, 1000
%14 = add i32 %10, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @get_seed() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = tail call i32 (...) @getpid()
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = add i32 %6, %4
%8 = mul i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add i32 %8, %11
ret i32 %12
}
/* Variables and functions */
int get_line(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *, int);
int main() {
  int length;
  char line[1000];
  while ((length = get_line(line, 1000)) > 0) {
    reverse(line, length);
    printf("%s\n", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <get_line@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1186 <main+0x56>
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <reverse@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1040 <get_line@plt>
test   %eax,%eax
jle    1186 <main+0x56>
mov    %rsp,%rbx
lea    0xeab(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1040 <get_line@plt>
test   %eax,%eax
jg     1160 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @get_line(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0, %5
%6 = phi i32 [ %9, %5 ], [ %3, %0 ]
%7 = call i32 @reverse(i8* %2, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @get_line(i8* %2, i32 1000)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %0
ret i32 0
}
unsigned char xtime(unsigned char x) {
  return ((x << 1) ^ (((x >> 7) & 1) * 0x1b));
}


x86 assembly (clang, -O0):
<xtime>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x7,%ecx
and    $0x1,%ecx
imul   $0x1b,%ecx,%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtime>:
lea    (%rdi,%rdi,1),%eax
sar    $0x7,%dil
and    $0x1b,%dil
xor    %dil,%al
ret

LLVM IR (-O0):
define zeroext i8 @xtime(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl i32 %4, 1
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = ashr i32 %7, 7
%9 = and i32 %8, 1
%10 = mul nsw i32 %9, 27
%11 = xor i32 %5, %10
%12 = trunc i32 %11 to i8
ret i8 %12
}

LLVM IR (-O2):
define zeroext i8 @xtime(i8 zeroext %0) {
%2 = shl i8 %0, 1
%3 = icmp slt i8 %0, 0
%4 = select i1 %3, i8 27, i8 0
%5 = xor i8 %4, %2
ret i8 %5
}
int chroma_sub_implemented(int mode) {
  switch (mode) {
  case 0:
  case 1:
  case 3:
    return 1;
  case 2:
  case 4:
  case 5:
  case 7:
  case 6:
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<chroma_sub_implemented>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2,%eax
jb     1151 <chroma_sub_implemented+0x51>
jmp    111b <chroma_sub_implemented+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     115d <chroma_sub_implemented+0x5d>
jmp    112c <chroma_sub_implemented+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     1151 <chroma_sub_implemented+0x51>
jmp    113d <chroma_sub_implemented+0x3d>
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x4,%eax
jb     115d <chroma_sub_implemented+0x5d>
jmp    1162 <chroma_sub_implemented+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1169 <chroma_sub_implemented+0x69>
jmp    1162 <chroma_sub_implemented+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chroma_sub_implemented>:
xor    %eax,%eax
cmp    $0x3,%edi
ja     1114 <chroma_sub_implemented+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @chroma_sub_implemented(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %5
i32 3, label %5
i32 2, label %6
i32 4, label %6
i32 5, label %6
i32 7, label %6
i32 6, label %6
]
5: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %8
6: ; preds = %1, %1, %1, %1, %1
br label %7
7: ; preds = %1, %6
store i32 0, i32* %2
br label %8
8: ; preds = %7, %5
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@switch.table.chroma_sub_implemented = [4 x i32] [i32 1, i32 1, i32 0, i32 1]
define i32 @chroma_sub_implemented(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.chroma_sub_implemented, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ UARTC0_Write(char);
void PrintHandler(char c) { UARTC0_Write(c); }


x86 assembly (clang, -O0):
<PrintHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <UARTC0_Write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintHandler>:
jmp    1030 <UARTC0_Write@plt>

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

LLVM IR (-O2):
define void @PrintHandler(i8 signext %0) {
%2 = tail call i32 @UARTC0_Write(i8 signext %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XErrorEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int xw_handle_error(Display *display, XErrorEvent *event) {
  static int error_count = 0;
  if (!event) {
    int ret_count = error_count;
    error_count = 0;
    return ret_count;
  };
  error_count++;
  return 0;
}


x86 assembly (clang, -O0):
<xw_handle_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1135 <xw_handle_error+0x35>
mov    0x2f07(%rip),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,0x2efa(%rip)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <xw_handle_error+0x4b>
mov    0x2ee9(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ee0(%rip)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xw_handle_error>:
mov    0x2f1e(%rip),%ecx
lea    0x1(%rcx),%edx
xor    %eax,%eax
test   %rsi,%rsi
cmove  %eax,%edx
cmove  %ecx,%eax
mov    %edx,0x2f0a(%rip)
ret

LLVM IR (-O0):
@xw_handle_error.error_count = internal global i32 0
define i32 @xw_handle_error(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %5
%8 = icmp ne i32* %7, null
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* @xw_handle_error.error_count
store i32 %10, i32* %6
store i32 0, i32* @xw_handle_error.error_count
%11 = load i32, i32* %6
store i32 %11, i32* %3
br label %15
12: ; preds = %2
%13 = load i32, i32* @xw_handle_error.error_count
%14 = add nsw i32 %13, 1
store i32 %14, i32* @xw_handle_error.error_count
store i32 0, i32* %3
br label %15
15: ; preds = %12, %9
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@xw_handle_error.error_count = internal unnamed_addr global i32 0
define i32 @xw_handle_error(i32* nocapture readnone %0, i32* readnone %1) {
%3 = icmp eq i32* %1, null
%4 = load i32, i32* @xw_handle_error.error_count
%5 = add nsw i32 %4, 1
%6 = select i1 %3, i32 0, i32 %5
%7 = select i1 %3, i32 %4, i32 0
store i32 %6, i32* @xw_handle_error.error_count
ret i32 %7
}
int Xendpl(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Xendpl() {
ret i32 0
}
/* Variables and functions */
int bit_weighted_count(int /*<<< orphan*/);
int /*<<< orphan*/ get_moves(unsigned long long const,
                             unsigned long long const);
int get_weighted_mobility(const unsigned long long P,
                          const unsigned long long O) {
  return bit_weighted_count(get_moves(P, O));
}


x86 assembly (clang, -O0):
<get_weighted_mobility>:
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 <get_moves@plt>
mov    %eax,%edi
call   1040 <bit_weighted_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @get_weighted_mobility(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 = load i64, i64* %4
%7 = call i32 @get_moves(i64 %5, i64 %6)
%8 = call i32 @bit_weighted_count(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_weighted_mobility(i64 %0, i64 %1) {
%3 = tail call i32 @get_moves(i64 %0, i64 %1)
%4 = tail call i32 @bit_weighted_count(i32 %3)
ret i32 %4
}
/* Variables and functions */
int f(char);
int g(char c) { return f(c + 3); }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x3,%eax
movsbl %al,%edi
call   1030 <f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
add    $0x3,%dil
movsbl %dil,%edi
jmp    1030 <f@plt>

LLVM IR (-O0):
define i32 @g(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, 3
%6 = trunc i32 %5 to i8
%7 = call i32 @f(i8 signext %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @g(i8 signext %0) {
%2 = add i8 %0, 3
%3 = tail call i32 @f(i8 signext %2)
ret i32 %3
}
/* Variables and functions */
int strlen(char *);
void fix_line(char *line) {
  int a;
  for (a = 0; a < strlen(line); a++) {
    if (line[a] == 2)
      line[a] = ' ';
  }
}


x86 assembly (clang, -O0):
<fix_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    1173 <fix_line+0x63>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2,%eax
jne    1160 <fix_line+0x50>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    1165 <fix_line+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <fix_line+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1151 <fix_line+0x41>
xor    %ebx,%ebx
jmp    1143 <fix_line+0x33>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1151 <fix_line+0x41>
cmpb   $0x2,(%r14,%rbx,1)
jne    1130 <fix_line+0x20>
movb   $0x20,(%r14,%rbx,1)
jmp    1130 <fix_line+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @fix_line(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1, %10
%5 = phi i64 [ %11, %10 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %4
store i8 32, i8* %6
br label %10
10: ; preds = %4, %9
%11 = add nuw nsw i64 %5, 1
%12 = tail call i32 @strlen(i8* %0)
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %11, %13
br i1 %14, label %4, label %15
15: ; preds = %10, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Backward();
int /*<<< orphan*/ Forward();
int /*<<< orphan*/ Wait(int);
void MoonSkill() {
  Forward();
  Wait(1000);
  Backward();
}


x86 assembly (clang, -O0):
<MoonSkill>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Forward@plt>
mov    $0x3e8,%edi
call   1050 <Wait@plt>
mov    $0x0,%al
call   1040 <Backward@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MoonSkill>:
push   %rax
xor    %eax,%eax
call   1030 <Forward@plt>
mov    $0x3e8,%edi
call   1050 <Wait@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <Backward@plt>

LLVM IR (-O0):
define void @MoonSkill() {
%1 = call i32 (...) @Forward()
%2 = call i32 @Wait(i32 1000)
%3 = call i32 (...) @Backward()
ret void
}

LLVM IR (-O2):
define void @MoonSkill() {
%1 = tail call i32 (...) @Forward()
%2 = tail call i32 @Wait(i32 1000)
%3 = tail call i32 (...) @Backward()
ret void
}
void os_enterKernel(void) {}


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

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

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

LLVM IR (-O2):
define void @os_enterKernel() {
ret void
}
/* Variables and functions */
int foo(int *, int *, int *);
int main(void) {
  int arr[] = {1, 2, 3};
  return foo(arr, arr + 1, arr + 2);
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xeee(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xedb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdi
call   1030 <foo@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
store i32 0, i32* %1
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = getelementptr inbounds i32, i32* %5, i64 1
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = call i32 @foo(i32* %4, i32* %6, i32* %8)
ret i32 %9
}

LLVM IR (-O2):
@__const.main.arr = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%6 = call i32 @foo(i32* %3, i32* %4, i32* %5)
ret i32 %6
}
int isoperator(const char *p) {
  char c = p[0];
  if (c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == ')') {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<isoperator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x2b,%eax
je     115f <isoperator+0x5f>
movsbl -0x11(%rbp),%eax
cmp    $0x2d,%eax
je     115f <isoperator+0x5f>
movsbl -0x11(%rbp),%eax
cmp    $0x2a,%eax
je     115f <isoperator+0x5f>
movsbl -0x11(%rbp),%eax
cmp    $0x2f,%eax
je     115f <isoperator+0x5f>
movsbl -0x11(%rbp),%eax
cmp    $0x28,%eax
je     115f <isoperator+0x5f>
movsbl -0x11(%rbp),%eax
cmp    $0x29,%eax
jne    116b <isoperator+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    1172 <isoperator+0x72>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isoperator>:
mov    (%rdi),%cl
add    $0xd8,%cl
xor    %eax,%eax
cmp    $0x7,%cl
ja     111a <isoperator+0x1a>
movsbq %cl,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @isoperator(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
store i8 %7, i8* %4
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 43
br i1 %10, label %31, label %11
11: ; preds = %1
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 45
br i1 %14, label %31, label %15
15: ; preds = %11
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 42
br i1 %18, label %31, label %19
19: ; preds = %15
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 47
br i1 %22, label %31, label %23
23: ; preds = %19
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 40
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 41
br i1 %30, label %31, label %32
31: ; preds = %27, %23, %19, %15, %11, %1
store i32 1, i32* %2
br label %33
32: ; preds = %27
store i32 0, i32* %2
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@switch.table.isoperator = [8 x i32] [i32 1, i32 1, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1]
define i32 @isoperator(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -40
%4 = icmp ult i8 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.isoperator, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
void test2declarer() { extern int test2_array[100]; }


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

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

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

LLVM IR (-O2):
define void @test2declarer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ pthread_exit(char *);
void *thread_function(void *arg) {
  printf("thread get message:%s\n", (char *)arg);
  pthread_exit("good bye");
}


x86 assembly (clang, -O0):
<thread_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_function>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"thread get message:%s\0A\00"
@.str.1 = [9 x i8] c"good bye\00"
define i8* @thread_function(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @pthread_exit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [23 x i8] c"thread get message:%s\0A\00"
@.str.1 = [9 x i8] c"good bye\00"
define noalias i8* @thread_function(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @pthread_exit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void buttonBoxCB(int button, int state) {
  printf("buttonBoxCB: button %d, state %d\n", button, state);
}


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

x86 assembly (clang, -O2):
<buttonBoxCB>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"buttonBoxCB: button %d, state %d\0A\00"
define void @buttonBoxCB(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"buttonBoxCB: button %d, state %d\0A\00"
define void @buttonBoxCB(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int libaft_internal_surfmeshrefiner_poly_setup_extra(double, double, double,
                                                     double, double);
int surface_refine_setup_poly_extra(double minabs, double min, double eps,
                                    double eps2, double dist) {
  return libaft_internal_surfmeshrefiner_poly_setup_extra(minabs, min, eps,
                                                          eps2, dist);
}


x86 assembly (clang, -O0):
<surface_refine_setup_poly_extra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
call   1030 <libaft_internal_surfmeshrefiner_poly_setup_extra@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<surface_refine_setup_poly_extra>:
jmp    1030 <libaft_internal_surfmeshrefiner_poly_setup_extra@plt>

LLVM IR (-O0):
define i32 @surface_refine_setup_poly_extra(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %6
%12 = load double, double* %7
%13 = load double, double* %8
%14 = load double, double* %9
%15 = load double, double* %10
%16 = call i32 @libaft_internal_surfmeshrefiner_poly_setup_extra(double %11, double %12, double %13, double %14, double %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @surface_refine_setup_poly_extra(double %0, double %1, double %2, double %3, double %4) {
%6 = tail call i32 @libaft_internal_surfmeshrefiner_poly_setup_extra(double %0, double %1, double %2, double %3, double %4)
ret i32 %6
}
/* Variables and functions */
unsigned long clk_get_pll_rate();
unsigned int reg_read_32(unsigned int volatile *);
unsigned long clk_get_dc_rate(void) {
  unsigned long pll_rate, dc_rate;
  unsigned int ctrl;
  pll_rate = clk_get_pll_rate();
  ctrl = reg_read_32((volatile unsigned int *)(0xbfe78034));
  dc_rate = pll_rate / ((ctrl & (0x7f << 24)) >> (24));
  return dc_rate;
}


x86 assembly (clang, -O0):
<clk_get_dc_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <clk_get_pll_rate@plt>
mov    %rax,-0x8(%rbp)
mov    $0xbfe78034,%edi
call   1030 <reg_read_32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
and    $0x7f000000,%ecx
shr    $0x18,%ecx
mov    %ecx,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clk_get_dc_rate>:
push   %rbx
xor    %eax,%eax
call   1040 <clk_get_pll_rate@plt>
mov    %rax,%rbx
mov    $0xbfe78034,%edi
call   1030 <reg_read_32@plt>
mov    %eax,%ecx
shr    $0x18,%ecx
and    $0x7f,%ecx
mov    %rbx,%rax
shr    $0x20,%rax
je     1150 <clk_get_dc_rate+0x30>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i64 @clk_get_dc_rate() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i32
%4 = call i64 (...) @clk_get_pll_rate()
store i64 %4, i64* %1
%5 = call i32 @reg_read_32(i32* inttoptr (i64 3219619892 to i32*))
store i32 %5, i32* %3
%6 = load i64, i64* %1
%7 = load i32, i32* %3
%8 = and i32 %7, 2130706432
%9 = lshr i32 %8, 24
%10 = zext i32 %9 to i64
%11 = udiv i64 %6, %10
store i64 %11, i64* %2
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
define i64 @clk_get_dc_rate() {
%1 = tail call i64 (...) @clk_get_pll_rate()
%2 = tail call i32 @reg_read_32(i32* inttoptr (i64 3219619892 to i32*))
%3 = lshr i32 %2, 24
%4 = and i32 %3, 127
%5 = zext i32 %4 to i64
%6 = udiv i64 %1, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ stderr;
int free_dvector(double *v) {
  if (!v) {
    fprintf(stderr, "free_dvector: pointer v empty\n");
    return 1;
  }
  free(v);
  return 0;
}


x86 assembly (clang, -O0):
<free_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1158 <free_dvector+0x38>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1168 <free_dvector+0x48>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dvector>:
push   %rax
test   %rdi,%rdi
je     112f <free_dvector+0xf>
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"free_dvector: pointer v empty\0A\00"
define i32 @free_dvector(double* %0) {
%2 = alloca i32
%3 = alloca double*
store double* %0, double** %3
%4 = load double*, double** %3
%5 = icmp ne double* %4, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %12
9: ; preds = %1
%10 = load double*, double** %3
%11 = call i32 @free(double* %10)
store i32 0, i32* %2
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"free_dvector: pointer v empty\0A\00"
define i32 @free_dvector(double* %0) {
%2 = icmp eq double* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 @free(double* %0)
br label %8
8: ; preds = %6, %3
%9 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a, b, c;
  c = 11 % 5;
  printf("%d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xed0(%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
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [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
store i32 1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
/* Type definitions */
struct RadarParm {
  int dummy;
};
struct FitData {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int FitWrite(int /*<<< orphan*/, struct RadarParm *, struct FitData *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int FitFwrite(FILE *fp, struct RadarParm *prm, struct FitData *fit) {
  return FitWrite(fileno(fp), prm, fit);
}


x86 assembly (clang, -O0):
<FitFwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fileno@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <FitWrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FitFwrite>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1040 <fileno@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <FitWrite@plt>

LLVM IR (-O0):
%struct.RadarParm = type { i32 }
%struct.FitData = type { i32 }
define i32 @FitFwrite(i32* %0, %struct.RadarParm* %1, %struct.FitData* %2) {
%4 = alloca i32*
%5 = alloca %struct.RadarParm*
%6 = alloca %struct.FitData*
store i32* %0, i32** %4
store %struct.RadarParm* %1, %struct.RadarParm** %5
store %struct.FitData* %2, %struct.FitData** %6
%7 = load i32*, i32** %4
%8 = call i32 @fileno(i32* %7)
%9 = load %struct.RadarParm*, %struct.RadarParm** %5
%10 = load %struct.FitData*, %struct.FitData** %6
%11 = call i32 @FitWrite(i32 %8, %struct.RadarParm* %9, %struct.FitData* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.RadarParm = type { i32 }
%struct.FitData = type { i32 }
define i32 @FitFwrite(i32* nocapture %0, %struct.RadarParm* %1, %struct.FitData* %2) {
%4 = tail call i32 @fileno(i32* %0)
%5 = tail call i32 @FitWrite(i32 %4, %struct.RadarParm* %1, %struct.FitData* %2)
ret i32 %5
}
/* Variables and functions */
int a_ctz_l(int);
int ffs(int i) { return i ? a_ctz_l(i) + 1 : 0; }


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1138 <ffs+0x28>
mov    -0x4(%rbp),%edi
call   1030 <a_ctz_l@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <ffs+0x32>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <ffs+0x32>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
test   %edi,%edi
je     1122 <ffs+0x12>
push   %rax
call   1030 <a_ctz_l@plt>
add    $0x1,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @a_ctz_l(i32 %6)
%8 = add nsw i32 %7, 1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %5
%11 = phi i32 [ %8, %5 ], [ 0, %9 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @a_ctz_l(i32 %0)
%5 = add nsw i32 %4, 1
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
double M_PI;
double nanotec_deg_to_rad(double deg) { return deg * M_PI / 180.0; }


x86 assembly (clang, -O0):
<nanotec_deg_to_rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xedf(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nanotec_deg_to_rad>:
mov    0x2ee1(%rip),%rax
mulsd  (%rax),%xmm0
divsd  0xeed(%rip),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @nanotec_deg_to_rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_PI
%5 = fmul double %3, %4
%6 = fdiv double %5, 1.800000e+02
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @nanotec_deg_to_rad(double %0) {
%2 = load double, double* @M_PI
%3 = fmul double %2, %0
%4 = fdiv double %3, 1.800000e+02
ret double %4
}
/* Variables and functions */
int EAGAIN;
int wb_is_blocking_error(int error) { return EAGAIN == error; }


x86 assembly (clang, -O0):
<wb_is_blocking_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wb_is_blocking_error>:
mov    0x2ed1(%rip),%rcx
xor    %eax,%eax
cmp    %edi,(%rcx)
sete   %al
ret

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

LLVM IR (-O2):
@EAGAIN = global i32 0
define i32 @wb_is_blocking_error(i32 %0) {
%2 = load i32, i32* @EAGAIN
%3 = icmp eq i32 %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
void i830_debug_dspstride(char *result, int len, int reg, uint32_t val,
                          uint32_t devid) {
  snprintf(result, len, "%d bytes", val);
}


x86 assembly (clang, -O0):
<i830_debug_dspstride>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%ecx
lea    0xec6(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i830_debug_dspstride>:
lea    0xee9(%rip),%rdx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%d bytes\00"
define void @i830_debug_dspstride(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %9
%14 = call i32 @snprintf(i8* %11, i32 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d bytes\00"
define void @i830_debug_dspstride(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int xchg_u8(char *, int);
extern int tas(char *m) { return xchg_u8(m, 1); }


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

x86 assembly (clang, -O2):
<tas>:
mov    $0x1,%esi
jmp    1030 <xchg_u8@plt>

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

LLVM IR (-O2):
define i32 @tas(i8* %0) {
%2 = tail call i32 @xchg_u8(i8* %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strlen(char *);
void join_channel(int sock, char channel[]) {
  char join_packet[512];
  sprintf(join_packet, "JOIN %s\r\n", channel);
  send(sock, join_packet, strlen(join_packet), 0);
}


x86 assembly (clang, -O0):
<join_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeac(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x21c(%rbp)
lea    -0x210(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x21c(%rbp),%edi
mov    -0x218(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<join_channel>:
push   %rbp
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%rdx
mov    %edi,%ebp
lea    0xebb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x208,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"JOIN %s\0D\0A\00"
define void @join_channel(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [512 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %3
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @send(i32 %9, i8* %10, i32 %12, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"JOIN %s\0D\0A\00"
define void @join_channel(i32 %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @send(i32 %0, i8* %4, i32 %6, i32 0)
ret void
}