xunge/DecIR huggingface dataset:
int _reset_GC314FS(char *BASE1) {
  int temp;
  *((unsigned int *)(BASE1 + 0x104)) = 0x00000000;
  *((unsigned int *)(BASE1 + 0x108)) = 0x00000000;
  *((unsigned int *)(BASE1 + 0x100)) = 0x0f10;
  *((unsigned int *)(BASE1 + 0x100)) |= 0x00000080;
  *((unsigned int *)(BASE1 + 0x170)) = 0x02;
  return 1;
}


x86 assembly (clang, -O0):
<_reset_GC314FS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x104(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x108(%rax)
mov    -0x8(%rbp),%rax
movl   $0xf10,0x100(%rax)
mov    -0x8(%rbp),%rax
mov    0x100(%rax),%ecx
or     $0x80,%ecx
mov    %ecx,0x100(%rax)
mov    -0x8(%rbp),%rax
movl   $0x2,0x170(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_reset_GC314FS>:
movl   $0x0,0x108(%rdi)
movq   $0xf90,0x100(%rdi)
movl   $0x2,0x170(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @_reset_GC314FS(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 260
%6 = bitcast i8* %5 to i32*
store i32 0, i32* %6
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 264
%9 = bitcast i8* %8 to i32*
store i32 0, i32* %9
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 256
%12 = bitcast i8* %11 to i32*
store i32 3856, i32* %12
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 256
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = or i32 %16, 128
store i32 %17, i32* %15
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 368
%20 = bitcast i8* %19 to i32*
store i32 2, i32* %20
ret i32 1
}

LLVM IR (-O2):
define i32 @_reset_GC314FS(i8* nocapture writeonly %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 260
%3 = bitcast i8* %2 to i32*
store i32 0, i32* %3
%4 = getelementptr inbounds i8, i8* %0, i64 264
%5 = bitcast i8* %4 to i32*
store i32 0, i32* %5
%6 = getelementptr inbounds i8, i8* %0, i64 256
%7 = bitcast i8* %6 to i32*
store i32 3984, i32* %7
%8 = getelementptr inbounds i8, i8* %0, i64 368
%9 = bitcast i8* %8 to i32*
store i32 2, i32* %9
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ close_files();
int /*<<< orphan*/ free_buffers();
int /*<<< orphan*/ free_titles();
void close_all() {
  free_buffers();
  close_files();
  free_titles();
}


x86 assembly (clang, -O0):
<close_all>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <free_buffers@plt>
mov    $0x0,%al
call   1050 <close_files@plt>
mov    $0x0,%al
call   1040 <free_titles@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_all>:
push   %rax
xor    %eax,%eax
call   1030 <free_buffers@plt>
xor    %eax,%eax
call   1050 <close_files@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <free_titles@plt>

LLVM IR (-O0):
define void @close_all() {
%1 = call i32 (...) @free_buffers()
%2 = call i32 (...) @close_files()
%3 = call i32 (...) @free_titles()
ret void
}

LLVM IR (-O2):
define void @close_all() {
%1 = tail call i32 (...) @free_buffers()
%2 = tail call i32 (...) @close_files()
%3 = tail call i32 (...) @free_titles()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int fcntl(int, int /*<<< orphan*/, int);
int fd_setopt(int fd, int flag) {
  int retval = -1;
  retval = fcntl(fd, F_GETFL, NULL);
  if (retval != -1) {
    retval |= flag;
    retval = fcntl(fd, F_SETFL, retval);
  }
  return retval;
}


x86 assembly (clang, -O0):
<fd_setopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     1165 <fd_setopt+0x55>
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
call   1030 <fcntl@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_setopt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    0x2eba(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
je     1146 <fd_setopt+0x36>
or     %ebp,%eax
mov    0x2eab(%rip),%rcx
mov    (%rcx),%esi
mov    %ebx,%edi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fcntl@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
define i32 @fd_setopt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 -1, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* @F_GETFL
%8 = call i32 @fcntl(i32 %6, i32 %7, i32 0)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = or i32 %13, %12
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = load i32, i32* @F_SETFL
%17 = load i32, i32* %5
%18 = call i32 @fcntl(i32 %15, i32 %16, i32 %17)
store i32 %18, i32* %5
br label %19
19: ; preds = %11, %2
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
define i32 @fd_setopt(i32 %0, i32 %1) {
%3 = load i32, i32* @F_GETFL
%4 = tail call i32 @fcntl(i32 %0, i32 %3, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = or i32 %4, %1
%8 = load i32, i32* @F_SETFL
%9 = tail call i32 @fcntl(i32 %0, i32 %8, i32 %7)
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ %9, %6 ], [ -1, %2 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ _sys_call(int, int /*<<< orphan*/, int /*<<< orphan*/,
                     int /*<<< orphan*/);
void *malloc(void) { return (void *)_sys_call(0x5A, 0, 0, 0); }


x86 assembly (clang, -O0):
<malloc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5a,%edi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <_sys_call@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc>:
mov    $0x5a,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <_sys_call@plt>

LLVM IR (-O0):
define i8* @malloc() {
%1 = call i64 @_sys_call(i32 90, i32 0, i32 0, i32 0)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}

LLVM IR (-O2):
define i8* @malloc() {
%1 = tail call i64 @_sys_call(i32 90, i32 0, i32 0, i32 0)
%2 = inttoptr i64 %1 to i8*
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ PodExit();
int /*<<< orphan*/ PodInit();
int /*<<< orphan*/ Read();
int /*<<< orphan*/ Write();
int main(void) {
  PodInit();
  Write();
  Read();
  PodExit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <PodInit@plt>
mov    $0x0,%al
call   1060 <Write@plt>
mov    $0x0,%al
call   1040 <Read@plt>
mov    $0x0,%al
call   1030 <PodExit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <PodInit@plt>
xor    %eax,%eax
call   1060 <Write@plt>
xor    %eax,%eax
call   1040 <Read@plt>
xor    %eax,%eax
call   1030 <PodExit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @PodInit()
%3 = call i32 (...) @Write()
%4 = call i32 (...) @Read()
%5 = call i32 (...) @PodExit()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @PodInit()
%2 = tail call i32 (...) @Write()
%3 = tail call i32 (...) @Read()
%4 = tail call i32 (...) @PodExit()
ret i32 0
}
void test1(void) {
  int a = 2;
  __asm__ goto("jmp %l0 \n" : : : : end);
  abort();
end:;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
jmp    112e <test1+0x1e>
jmp    1129 <test1+0x19>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rax
jmp    1118 <test1+0x8>
call   1030 <abort@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @test1() {
%1 = alloca i32
store i32 2, i32* %1
to label %2 [label %3]
2: ; preds = %0
unreachable
3: ; preds = %0
ret void
}

LLVM IR (-O2):
define void @test1() {
to label %1 [label %2]
1: ; preds = %0
tail call void @abort()
unreachable
2: ; preds = %0
ret void
}
/* Variables and functions */
int INT_MAX;
int intdivint(int divid, int divis) {
  if (divis == 0)
    return INT_MAX;
  if (divid == INT_MAX)
    return INT_MAX;
  else
    return divid / divis;
}


x86 assembly (clang, -O0):
<intdivint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1125 <intdivint+0x25>
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <intdivint+0x52>
mov    -0x8(%rbp),%eax
mov    0x2eb9(%rip),%rcx
cmp    (%rcx),%eax
jne    1148 <intdivint+0x48>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <intdivint+0x52>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intdivint>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
test   %esi,%esi
je     1119 <intdivint+0x19>
cmp    %edi,%eax
jne    1114 <intdivint+0x14>
mov    %edi,%eax
ret
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @intdivint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* @INT_MAX
store i32 %9, i32* %3
br label %20
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* @INT_MAX
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* @INT_MAX
store i32 %15, i32* %3
br label %20
16: ; preds = %10
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = sdiv i32 %17, %18
store i32 %19, i32* %3
br label %20
20: ; preds = %16, %14, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @intdivint(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = load i32, i32* @INT_MAX
br i1 %3, label %9, label %5
5: ; preds = %2
%6 = icmp eq i32 %4, %0
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = sdiv i32 %0, %1
br label %9
9: ; preds = %2, %5, %7
%10 = phi i32 [ %8, %7 ], [ %0, %5 ], [ %4, %2 ]
ret i32 %10
}
unsigned count_bits(unsigned i) {
  unsigned n = 0;
  while (i) {
    if (i & 1)
      ++n;
    i >>= 1;
  }
  return n;
}


x86 assembly (clang, -O0):
<count_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113e <count_bits+0x3e>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1130 <count_bits+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <count_bits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_bits>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <count_bits+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <count_bits+0x10>
ret

LLVM IR (-O0):
define i32 @count_bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %2
%16 = lshr i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @count_bits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
int countSpclchars(const char *str) {
  int spclchars = 0;
  for (int i = 0; str[i] != '\0'; i++) {
    if (str[i] == 32 || str[i] == 39)
      spclchars++;
  }
  return spclchars;
}


x86 assembly (clang, -O0):
<countSpclchars>:
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     1171 <countSpclchars+0x71>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1155 <countSpclchars+0x55>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x27,%eax
jne    115e <countSpclchars+0x5e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <countSpclchars+0x63>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <countSpclchars+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countSpclchars>:
xor    %eax,%eax
jmp    1117 <countSpclchars+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x20,%cl
je     1110 <countSpclchars+0x10>
cmp    $0x27,%cl
je     1110 <countSpclchars+0x10>
test   %cl,%cl
jne    1113 <countSpclchars+0x13>
ret

LLVM IR (-O0):
define i32 @countSpclchars(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 = %33, %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 %36
13: ; preds = %5
%14 = load i8*, i8** %2
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 32
br i1 %20, label %29, label %21
21: ; preds = %13
%22 = load i8*, i8** %2
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 39
br i1 %28, label %29, label %32
29: ; preds = %21, %13
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %32
32: ; preds = %29, %21
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %5
36: ; preds = %5
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @countSpclchars(i8* nocapture %0) {
br label %2
2: ; preds = %10, %1
%3 = phi i64 [ %12, %10 ], [ 0, %1 ]
%4 = phi i32 [ %11, %10 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %10 [
i8 0, label %7
i8 32, label %8
i8 39, label %8
]
7: ; preds = %2
ret i32 %4
8: ; preds = %2, %2
%9 = add nsw i32 %4, 1
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ %9, %8 ], [ %4, %2 ]
%12 = add nuw i64 %3, 1
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ complex;

/* Variables and functions */
int cimag(int /*<<< orphan*/);
int creal(int /*<<< orphan*/);
float sqrt(int);
float modulo(complex z) {
  return sqrt(creal(z) * creal(z) + cimag(z) * cimag(z));
}


x86 assembly (clang, -O0):
<modulo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <creal@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <creal@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <cimag@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <cimag@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1050 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modulo>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
call   1030 <creal@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1030 <creal@plt>
imul   %eax,%r14d
mov    %ebx,%edi
call   1040 <cimag@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <cimag@plt>
imul   %eax,%ebp
add    %r14d,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <sqrt@plt>

LLVM IR (-O0):
define float @modulo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @creal(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @creal(i32 %5)
%7 = mul nsw i32 %4, %6
%8 = load i32, i32* %2
%9 = call i32 @cimag(i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @cimag(i32 %10)
%12 = mul nsw i32 %9, %11
%13 = add nsw i32 %7, %12
%14 = call float @sqrt(i32 %13)
ret float %14
}

LLVM IR (-O2):
define float @modulo(i32 %0) {
%2 = tail call i32 @creal(i32 %0)
%3 = tail call i32 @creal(i32 %0)
%4 = mul nsw i32 %3, %2
%5 = tail call i32 @cimag(i32 %0)
%6 = tail call i32 @cimag(i32 %0)
%7 = mul nsw i32 %6, %5
%8 = add nsw i32 %7, %4
%9 = tail call float @sqrt(i32 %8)
ret float %9
}
unsigned char snratio(double snr) {
  return (unsigned char)(snr <= 0.0 || 255.5 <= snr ? 0.0 : snr * 4.0 + 0.5);
}


x86 assembly (clang, -O0):
<snratio>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jae    112e <snratio+0x2e>
movsd  -0x8(%rbp),%xmm0
movsd  0xedc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     113b <snratio+0x3b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115d <snratio+0x5d>
movsd  -0x8(%rbp),%xmm0
movsd  0xec0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<snratio>:
xor    %ecx,%ecx
ucomisd 0xef6(%rip),%xmm0
movsd  0xef6(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef2(%rip),%xmm1
cvttsd2si %xmm1,%eax
cmovae %ecx,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @snratio(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ole double %3, 0.000000e+00
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load double, double* %2
%7 = fcmp ole double 2.555000e+02, %6
br i1 %7, label %8, label %9
8: ; preds = %5, %1
br label %12
9: ; preds = %5
%10 = load double, double* %2
%11 = call double @llvm.fmuladd.f64(double %10, double 4.000000e+00, double 5.000000e-01)
br label %12
12: ; preds = %9, %8
%13 = phi double [ 0.000000e+00, %8 ], [ %11, %9 ]
%14 = fptoui double %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @snratio(double %0) {
%2 = fcmp ole double %0, 0.000000e+00
%3 = fcmp oge double %0, 2.555000e+02
%4 = or i1 %2, %3
%5 = tail call double @llvm.fmuladd.f64(double %0, double 4.000000e+00, double 5.000000e-01)
%6 = fptoui double %5 to i8
%7 = select i1 %4, i8 0, i8 %6
ret i8 %7
}
int test_imm_A0int64_midword_reg(long long val) {
  return ((val >> 16) & (0xA0 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A0int64_midword_reg>:
test   $0xa00000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A0int64_midword_reg(i64 %0) {
%2 = and i64 %0, 10485760
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void xxtea_decode_byte(char *v, int *k, int p) {
  char y[] = "XtEaNpK";
  *v = *v ^ (char)(k[p % 4] % 0xFF) ^ y[p];
}


x86 assembly (clang, -O0):
<xxtea_decode_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0xeea(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
mov    %dl,%cl
movsbl %cl,%ecx
xor    %ecx,%eax
movslq -0x14(%rbp),%rcx
movsbl -0x1c(%rbp,%rcx,1),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxtea_decode_byte>:
lea    0x3(%rdx),%eax
test   %edx,%edx
cmovns %edx,%eax
and    $0xfffffffc,%eax
movslq %edx,%rcx
sub    %eax,%edx
movslq %edx,%rax
movslq (%rsi,%rax,4),%rax
imul   $0xffffffff80808081,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%esi
shr    $0x1f,%esi
shr    $0x7,%edx
add    %esi,%edx
add    %eax,%edx
lea    0xec9(%rip),%rax
mov    (%rcx,%rax,1),%al
xor    (%rdi),%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
@__const.xxtea_decode_byte.y = [8 x i8] c"XtEaNpK\00"
define void @xxtea_decode_byte(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [8 x i8]
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = bitcast [8 x i8]* %7 to i8*
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i32*, i32** %5
%13 = load i32, i32* %6
%14 = srem i32 %13, 4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
%17 = load i32, i32* %16
%18 = srem i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = sext i8 %19 to i32
%21 = xor i32 %11, %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = xor i32 %21, %26
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %4
store i8 %28, i8* %29
ret void
}

LLVM IR (-O2):
@__const.xxtea_decode_byte.y = [8 x i8] c"XtEaNpK\00"
define void @xxtea_decode_byte(i8* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i8, i8* %0
%5 = srem i32 %2, 4
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = load i32, i32* %7
%9 = srem i32 %8, 255
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.xxtea_decode_byte.y, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = trunc i32 %9 to i8
%14 = xor i8 %12, %4
%15 = xor i8 %14, %13
store i8 %15, i8* %0
ret void
}
/* Variables and functions */
unsigned long callthru5(int, unsigned long, unsigned long, unsigned long,
                        int /*<<< orphan*/, unsigned long);
unsigned long bogus_socket_conn_send(int dev, void *addr, int maxlen,
                                     int conn) {
  return callthru5(225, (unsigned long)dev, (unsigned long)addr,
                   (unsigned long)maxlen, 0, (unsigned long)conn);
}


x86 assembly (clang, -O0):
<bogus_socket_conn_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movslq -0x4(%rbp),%rsi
mov    -0x10(%rbp),%rdx
movslq -0x14(%rbp),%rcx
movslq -0x18(%rbp),%r9
mov    $0xe1,%edi
xor    %r8d,%r8d
call   1030 <callthru5@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bogus_socket_conn_send>:
mov    %rsi,%r8
movslq %edi,%rsi
movslq %edx,%rax
movslq %ecx,%r9
mov    $0xe1,%edi
mov    %r8,%rdx
mov    %rax,%rcx
xor    %r8d,%r8d
jmp    1030 <callthru5@plt>

LLVM IR (-O0):
define i64 @bogus_socket_conn_send(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = load i8*, i8** %6
%12 = ptrtoint i8* %11 to i64
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = call i64 @callthru5(i32 225, i64 %10, i64 %12, i64 %14, i32 0, i64 %16)
ret i64 %17
}

LLVM IR (-O2):
define i64 @bogus_socket_conn_send(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = sext i32 %0 to i64
%6 = ptrtoint i8* %1 to i64
%7 = sext i32 %2 to i64
%8 = sext i32 %3 to i64
%9 = tail call i64 @callthru5(i32 225, i64 %5, i64 %6, i64 %7, i32 0, i64 %8)
ret i64 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void saft_error_handler_default(const char *fmt, va_list ap) {
  fprintf(stderr, "[ERROR] ");
  vfprintf(stderr, fmt, ap);
  fprintf(stderr, ".\n");
}


x86 assembly (clang, -O0):
<saft_error_handler_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <vfprintf@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saft_error_handler_default>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb0(%rip),%r14
mov    (%r14),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <vfprintf@plt>
mov    (%r14),%edi
lea    0xeb3(%rip),%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"[ERROR] \00"
@.str.1 = [3 x i8] c".\0A\00"
define void @saft_error_handler_default(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @vfprintf(i32 %7, i8* %8, i32 %9)
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"[ERROR] \00"
@.str.1 = [3 x i8] c".\0A\00"
define void @saft_error_handler_default(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @vfprintf(i32 %5, i8* %0, i32 %1)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void *x(int i) {}


x86 assembly (clang, -O0):
<x>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @x(i32 %0) {
ret i8* undef
}
void _strcat_ptr(char *s, const char *t) {
  while (*s)
    s++;
  while (*t)
    *s++ = *t++;
  *s = '\0';
}


x86 assembly (clang, -O0):
<_strcat_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     112a <_strcat_ptr+0x2a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <_strcat_ptr+0xc>
jmp    112f <_strcat_ptr+0x2f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <_strcat_ptr+0x63>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    112f <_strcat_ptr+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strcat_ptr>:
mov    %rdi,%rcx
add    $0x1,%rdi
cmpb   $0x0,(%rcx)
jne    1100 <_strcat_ptr>
mov    (%rsi),%al
test   %al,%al
je     1136 <_strcat_ptr+0x36>
mov    $0xffffffffffffffff,%rcx
nopl   0x0(%rax)
mov    %al,(%rdi,%rcx,1)
movzbl 0x2(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1120 <_strcat_ptr+0x20>
add    %rcx,%rdi
mov    %rdi,%rcx
movb   $0x0,(%rcx)
ret

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

LLVM IR (-O2):
define void @_strcat_ptr(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %15, %11 ], [ %1, %8 ]
%14 = phi i8* [ %16, %11 ], [ %4, %8 ]
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %12, i8* %14
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
%20 = phi i8* [ %4, %8 ], [ %16, %11 ]
store i8 0, i8* %20
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(unsigned int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
void UpdateFileEidxHeader(FILE *fp, char *file_name, unsigned int num_edges) {
  rewind(fp);
  if (!fwrite(&num_edges, sizeof(int), 1, fp)) {
    perror(file_name);
    exit(EXIT_FAILURE);
  };
  ;
}


x86 assembly (clang, -O0):
<UpdateFileEidxHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x8(%rbp),%rcx
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
cmp    $0x0,%eax
jne    1193 <UpdateFileEidxHeader+0x53>
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpdateFileEidxHeader>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,0x4(%rsp)
call   1030 <rewind@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %eax,%eax
je     1176 <UpdateFileEidxHeader+0x36>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
call   1040 <perror@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @UpdateFileEidxHeader(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = call i32 @rewind(i32* %7)
%9 = load i32*, i32** %4
%10 = call i32 @fwrite(i32* %6, i32 4, i32 1, i32* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32 @perror(i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @UpdateFileEidxHeader(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = tail call i32 @rewind(i32* %0)
%6 = call i32 @fwrite(i32* %4, i32 4, i32 1, i32* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 @perror(i8* %1)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %3
ret void
}
char *buildTag() { return ("sw-gotoh.32b.cpu"); }


x86 assembly (clang, -O0):
<buildTag>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildTag>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"sw-gotoh.32b.cpu\00"
define i8* @buildTag() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [17 x i8] c"sw-gotoh.32b.cpu\00"
define i8* @buildTag() {
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
}
int main() { return 0UL > 0UL; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void func5(int a, int *b, char c) {
  int var1 = 1;
  *(var1 + b) = 400;
}


x86 assembly (clang, -O0):
<func5>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
movl   $0x190,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<func5>:
movl   $0x190,0x4(%rsi)
ret

LLVM IR (-O0):
define void @func5(i32 %0, i32* %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i8 %2, i8* %6
store i32 1, i32* %7
%8 = load i32, i32* %7
%9 = load i32*, i32** %5
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i32, i32* %9, i64 %10
store i32 400, i32* %11
ret void
}

LLVM IR (-O2):
define void @func5(i32 %0, i32* nocapture writeonly %1, i8 signext %2) {
%4 = getelementptr inbounds i32, i32* %1, i64 1
store i32 400, i32* %4
ret void
}
int fun1317() { return 1317; }


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

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

LLVM IR (-O0):
define i32 @fun1317() {
ret i32 1317
}

LLVM IR (-O2):
define i32 @fun1317() {
ret i32 1317
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
void function_pointer_cast_helper(char **a) { strcmp("Hi", *a); }


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

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

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

LLVM IR (-O2):
define void @function_pointer_cast_helper(i8** nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;
struct in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int const, int const, int const,
                           int const);
char *inet_ntoa(struct in_addr addr) {
  static char name[16];
  const uint8_t *cp = (const uint8_t *)&addr.s_addr;
  sprintf(name, "%u.%u.%u.%u", cp[0], cp[1], cp[2], cp[3]);
  return name;
}


x86 assembly (clang, -O0):
<inet_ntoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r9d
lea    0x2ef9(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2ee6(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_ntoa>:
push   %rbx
mov    %edi,%edx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@inet_ntoa.name = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%u.%u.%u.%u\00"
define i8* @inet_ntoa(i32 %0) {
%2 = alloca %struct.in_addr
%3 = alloca i32*
%4 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i32 0, i32 0
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 3
%17 = load i32, i32* %16
%18 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.name, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14, i32 %17)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.name, i64 0, i64 0)
}

LLVM IR (-O2):
@inet_ntoa.name = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%u.%u.%u.%u\00"
define i8* @inet_ntoa(i32 %0) {
%2 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.name, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0, i32 poison, i32 poison, i32 poison)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @inet_ntoa.name, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ delayUsBusy(int);
int /*<<< orphan*/ pinHigh(int);
int /*<<< orphan*/ pinLow(int);
int /*<<< orphan*/ pinModeIn(int);
int /*<<< orphan*/ pinModeOut(int);
int pinRead(int);
int onewire_read_bit(int pin) {
  pinModeOut(pin);
  pinLow(pin);
  delayUsBusy(2);
  pinHigh(pin);
  delayUsBusy(2);
  pinModeIn(pin);
  int r = pinRead(pin);
  pinModeOut(pin);
  delayUsBusy(60);
  return r;
}


x86 assembly (clang, -O0):
<onewire_read_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <pinModeOut@plt>
mov    -0x4(%rbp),%edi
call   1070 <pinLow@plt>
mov    $0x2,%edi
call   1030 <delayUsBusy@plt>
mov    -0x4(%rbp),%edi
call   1040 <pinHigh@plt>
mov    $0x2,%edi
call   1030 <delayUsBusy@plt>
mov    -0x4(%rbp),%edi
call   1060 <pinModeIn@plt>
mov    -0x4(%rbp),%edi
call   1080 <pinRead@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <pinModeOut@plt>
mov    $0x3c,%edi
call   1030 <delayUsBusy@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<onewire_read_bit>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1050 <pinModeOut@plt>
mov    %ebx,%edi
call   1070 <pinLow@plt>
mov    $0x2,%edi
call   1030 <delayUsBusy@plt>
mov    %ebx,%edi
call   1040 <pinHigh@plt>
mov    $0x2,%edi
call   1030 <delayUsBusy@plt>
mov    %ebx,%edi
call   1060 <pinModeIn@plt>
mov    %ebx,%edi
call   1080 <pinRead@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1050 <pinModeOut@plt>
mov    $0x3c,%edi
call   1030 <delayUsBusy@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @onewire_read_bit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @pinModeOut(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @pinLow(i32 %6)
%8 = call i32 @delayUsBusy(i32 2)
%9 = load i32, i32* %2
%10 = call i32 @pinHigh(i32 %9)
%11 = call i32 @delayUsBusy(i32 2)
%12 = load i32, i32* %2
%13 = call i32 @pinModeIn(i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @pinRead(i32 %14)
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = call i32 @pinModeOut(i32 %16)
%18 = call i32 @delayUsBusy(i32 60)
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @onewire_read_bit(i32 %0) {
%2 = tail call i32 @pinModeOut(i32 %0)
%3 = tail call i32 @pinLow(i32 %0)
%4 = tail call i32 @delayUsBusy(i32 2)
%5 = tail call i32 @pinHigh(i32 %0)
%6 = tail call i32 @delayUsBusy(i32 2)
%7 = tail call i32 @pinModeIn(i32 %0)
%8 = tail call i32 @pinRead(i32 %0)
%9 = tail call i32 @pinModeOut(i32 %0)
%10 = tail call i32 @delayUsBusy(i32 60)
ret i32 %8
}
extern void writew(unsigned short b, unsigned long addr) {
  *(volatile unsigned int *)((addr << 7) +
                             ((0xfffffc0000000000UL) + 0x200000000UL) + 0x20) =
      b * 0x00010001;
}


x86 assembly (clang, -O0):
<writew>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
imul   $0x10001,%eax,%ecx
mov    -0x10(%rbp),%rax
shl    $0x7,%rax
movabs $0xfffffc0200000000,%rdx
fc ff ff
add    %rdx,%rax
mov    %ecx,0x20(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writew>:
mov    %edi,%eax
shl    $0x10,%eax
or     %edi,%eax
shl    $0x7,%rsi
movabs $0xfffffc0200000020,%rcx
fc ff ff
mov    %eax,(%rsi,%rcx,1)
ret

LLVM IR (-O0):
define void @writew(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = mul nsw i32 %6, 65537
%8 = load i64, i64* %4
%9 = shl i64 %8, 7
%10 = add i64 %9, -4389456576512
%11 = add i64 %10, 32
%12 = inttoptr i64 %11 to i32*
store volatile i32 %7, i32* %12
ret void
}

LLVM IR (-O2):
define void @writew(i16 zeroext %0, i64 %1) {
%3 = zext i16 %0 to i32
%4 = mul nuw nsw i32 %3, 65537
%5 = shl i64 %1, 7
%6 = add i64 %5, -4389456576480
%7 = inttoptr i64 %6 to i32*
store volatile i32 %4, i32* %7
ret void
}
double _Complex sub_double_cr(double _Complex a, double b) { return a - b; }


x86 assembly (clang, -O0):
<sub_double_cr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_double_cr>:
subsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define { double, double } @sub_double_cr(double %0, double %1, double %2) {
%4 = alloca { double, double }
%5 = alloca { double, double }
%6 = alloca double
%7 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
store double %0, double* %7
%8 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
store double %1, double* %8
store double %2, double* %6
%9 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
%10 = load double, double* %9
%11 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
%12 = load double, double* %11
%13 = load double, double* %6
%14 = fsub double %10, %13
%15 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%16 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
store double %14, double* %15
store double %12, double* %16
%17 = load { double, double }, { double, double }* %4
ret { double, double } %17
}

LLVM IR (-O2):
define { double, double } @sub_double_cr(double %0, double %1, double %2) {
%4 = fsub double %0, %2
%5 = insertvalue { double, double } poison, double %4, 0
%6 = insertvalue { double, double } %5, double %1, 1
ret { double, double } %6
}
void USBD_USR_DeviceConfigured(void) {}


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

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

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

LLVM IR (-O2):
define void @USBD_USR_DeviceConfigured() {
ret void
}
float prv_process_fpa_div_real32(float a, float b) { return a / b; }


x86 assembly (clang, -O0):
<prv_process_fpa_div_real32>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<prv_process_fpa_div_real32>:
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @prv_process_fpa_div_real32(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @prv_process_fpa_div_real32(float %0, float %1) {
%3 = fdiv float %0, %1
ret float %3
}
/* Type definitions */
struct stdlog_header {
  int dummy;
};

/* Variables and functions */
int stdlog_encodef(char *, int, struct stdlog_header *, char const *, char *,
                   char const *);
int stdlog_encode(char *buf, int len, struct stdlog_header *hdr, const char *sd,
                  const char *msg) {
  return stdlog_encodef(buf, len, hdr, sd, "%s", msg);
}


x86 assembly (clang, -O0):
<stdlog_encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r9
lea    0xebb(%rip),%r8
call   1030 <stdlog_encodef@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlog_encode>:
mov    %r8,%r9
lea    0xee6(%rip),%r8
jmp    1030 <stdlog_encodef@plt>

LLVM IR (-O0):
%struct.stdlog_header = type { i32 }
@.str = [3 x i8] c"%s\00"
define i32 @stdlog_encode(i8* %0, i32 %1, %struct.stdlog_header* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.stdlog_header*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store %struct.stdlog_header* %2, %struct.stdlog_header** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load %struct.stdlog_header*, %struct.stdlog_header** %8
%14 = load i8*, i8** %9
%15 = load i8*, i8** %10
%16 = call i32 @stdlog_encodef(i8* %11, i32 %12, %struct.stdlog_header* %13, i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.stdlog_header = type { i32 }
@.str = [3 x i8] c"%s\00"
define i32 @stdlog_encode(i8* %0, i32 %1, %struct.stdlog_header* %2, i8* %3, i8* %4) {
%6 = tail call i32 @stdlog_encodef(i8* %0, i32 %1, %struct.stdlog_header* %2, i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 %6
}
/* Variables and functions */
int fabs(float);
bool iszero(float value) { return fabs(value) <= 1e-5; }


x86 assembly (clang, -O0):
<iszero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xecd(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iszero>:
push   %rax
call   1030 <fabs@plt>
xor    %ecx,%ecx
test   %eax,%eax
setle  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @iszero(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @fabs(float %3)
%5 = sitofp i32 %4 to double
%6 = fcmp ole double %5, 1.000000e-05
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @iszero(float %0) {
%2 = tail call i32 @fabs(float %0)
%3 = icmp slt i32 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}