xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ insertionSort(int *, int);
int /*<<< orphan*/ print(int *, int);
int main() {
  int arr[] = {10, 29, 1, 9, 37, 24, 6, 3, 11};
  int n = sizeof(arr) / sizeof(arr[0]);
  insertionSort(arr, n);
  print(arr, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
movl   $0x9,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <insertionSort@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef5(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <insertionSort@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.arr = [9 x i32] [i32 10, i32 29, i32 1, i32 9, i32 37, i32 24, i32 6, i32 3, i32 11]
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @insertionSort(i32* %3, i32 9)
%5 = call i32 @print(i32* %3, i32 9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ standard_command(int, int /*<<< orphan*/, int /*<<< orphan*/,
                                    char **);
void no_arguments_command(int opcode_byte, char **arguments) {
  standard_command(opcode_byte, 0, 0, arguments);
}


x86 assembly (clang, -O0):
<no_arguments_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rcx
xor    %edx,%edx
mov    %edx,%esi
call   1030 <standard_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_arguments_command>:
mov    %rsi,%rcx
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <standard_command@plt>

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

LLVM IR (-O2):
define void @no_arguments_command(i32 %0, i8** %1) {
%3 = tail call i32 @standard_command(i32 %0, i32 0, i32 0, i8** %1)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t read_defect_data_10_list_format(uint8_t *data) {
  return data[1] & 0x07;
}


x86 assembly (clang, -O0):
<read_defect_data_10_list_format>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_defect_data_10_list_format>:
mov    0x4(%rdi),%eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @read_defect_data_10_list_format(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, 7
ret i32 %6
}

LLVM IR (-O2):
define i32 @read_defect_data_10_list_format(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = and i32 %3, 7
ret i32 %4
}
void LPCCOMxIntClear(unsigned long ulBase, unsigned long ulIntFlags) {
  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x00000120))) |= ulIntFlags;
}


x86 assembly (clang, -O0):
<LPCCOMxIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x120(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x120(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCCOMxIntClear>:
or     %rsi,0x120(%rdi)
ret

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

LLVM IR (-O2):
define void @LPCCOMxIntClear(i64 %0, i64 %1) {
%3 = add i64 %0, 288
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = or i64 %5, %1
store volatile i64 %6, i64* %4
ret void
}
int hashfunct(str, hash_size) const char *str;
int hash_size;
{
  int hashval;
  int locstr;
  hashval = 0;
  locstr = 0;
  while (str[locstr]) {
    hashval = (hashval << 1) + (unsigned char)str[locstr++];
    hashval %= hash_size;
  }
  return hashval;
}


x86 assembly (clang, -O0):
<hashfunct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115d <hashfunct+0x5d>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%rcx
mov    -0x14(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
jmp    1119 <hashfunct+0x19>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashfunct>:
mov    (%rdi),%al
test   %al,%al
je     1127 <hashfunct+0x27>
add    $0x1,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movzbl %al,%eax
lea    (%rax,%rdx,2),%eax
cltd
idiv   %esi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hashfunct+0x10>
mov    %edx,%eax
ret
xor    %edx,%edx
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hashfunct(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = phi i8 [ %15, %5 ], [ %3, %2 ]
%8 = phi i32 [ %13, %5 ], [ 0, %2 ]
%9 = shl i32 %8, 1
%10 = add nuw nsw i64 %6, 1
%11 = zext i8 %7 to i32
%12 = add nsw i32 %9, %11
%13 = srem i32 %12, %1
%14 = getelementptr inbounds i8, i8* %0, i64 %10
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %5, %2
%18 = phi i32 [ 0, %2 ], [ %13, %5 ]
ret i32 %18
}
/* Variables and functions */
char *foo();
int /*<<< orphan*/ printf(char *, char);
int main() {
  int j = 3;
  for (int i = 0; i < j; i++) {
    printf("i = %d\n", i);
  }
  char *p = foo();
  printf("*p = %c\n", *p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1169 <main+0x49>
mov    -0xc(%rbp),%eax
lea    0xead(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    $0x0,%al
call   1040 <foo@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
lea    0xe89(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <foo@plt>
movsbl (%rax),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"i = %d\0A\00"
@.str.1 = [9 x i8] c"*p = %c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8 signext 2)
%4 = tail call i8* (...) @foo()
%5 = load i8, i8* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8 signext %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  puts(argv[1]);
  puts(argv[2]);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <puts@plt>
mov    0x10(%rbx),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @puts(i8* %8)
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 2
%12 = load i8*, i8** %11
%13 = call i32 @puts(i8* %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
char *strchr(const char *s, int c) {
  do {
    if (*s == c)
      return (char *)s;
  } while (*s++ != 0);
  return ((void *)0);
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1150 <strchr+0x50>
jmp    112d <strchr+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rax),%ecx
cmp    %esi,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %3
11: ; preds = %8, %3
%12 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %12
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int usage() {
  printf("return the sign of entry into the subnet ip\n");
  printf("require: ip mask test\n");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"return the sign of entry into the subnet ip\0A\00"
@.str.1 = [23 x i8] c"require: ip mask test\0A\00"
define i32 @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [44 x i8] c"return the sign of entry into the subnet ip\00"
@str.2 = [22 x i8] c"require: ip mask test\00"
define i32 @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
int doubleCompare(const void *v1, const void *v2) {
  double d1 = *((const double *)v1);
  double d2 = *((const double *)v2);
  if (d1 < d2) {
    return -1;
  } else if (d1 == d2) {
    return 0;
  } else {
    return 1;
  };
}


x86 assembly (clang, -O0):
<doubleCompare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1146 <doubleCompare+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    116f <doubleCompare+0x6f>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    1168 <doubleCompare+0x68>
jp     1168 <doubleCompare+0x68>
movl   $0x0,-0x4(%rbp)
jmp    116f <doubleCompare+0x6f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleCompare>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movapd %xmm0,%xmm2
cmpneqsd %xmm1,%xmm2
movq   %xmm2,%rcx
and    $0x1,%ecx
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @doubleCompare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fcmp olt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp oeq double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %3
br label %24
23: ; preds = %18
store i32 1, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @doubleCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp olt double %4, %6
%8 = fcmp une double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ findToken(int);
int /*<<< orphan*/ release(int /*<<< orphan*/);
void resource_Release(int token) { release(findToken(token)); }


x86 assembly (clang, -O0):
<resource_Release>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <findToken@plt>
mov    %eax,%edi
call   1040 <release@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @resource_Release(i32 %0) {
%2 = tail call i32 @findToken(i32 %0)
%3 = tail call i32 @release(i32 %2)
ret void
}
int stol(val)
char *val;
{
  if (val[0] == 'F')
    return (0);
  if (val[0] == 'T')
    return (1);
  return ((atoi(val) != 0));
}


x86 assembly (clang, -O0):
<stol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jne    1138 <stol+0x28>
movl   $0x0,-0x4(%rbp)
jmp    116d <stol+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x54,%eax
jne    1154 <stol+0x44>
movl   $0x1,-0x4(%rbp)
jmp    116d <stol+0x5d>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <atoi@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stol>:
push   %rax
mov    (%rdi),%al
cmp    $0x46,%al
je     1122 <stol+0x12>
cmp    $0x54,%al
jne    1126 <stol+0x16>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <atoi@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @stol(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 70
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %22
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 84
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 1, i32* %2
br label %22
17: ; preds = %10
%18 = load i8*, i8** %3
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %18)
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i32
store i32 %21, i32* %2
br label %22
22: ; preds = %17, %16, %9
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @stol(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %4 [
i8 70, label %8
i8 84, label %3
]
3: ; preds = %1
br label %8
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %0)
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %4, %3
%9 = phi i32 [ 1, %3 ], [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello from libtool\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"Hello from libtool\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [19 x i8] c"Hello from libtool\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int isprime(int n) {
  int i = 2;
  while (n % i != 0 && i <= n)
    i++;
  if (i == n)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isprime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0xd(%rbp)
je     112f <isprime+0x2f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    113f <isprime+0x3f>
jmp    114d <isprime+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <isprime+0xe>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1165 <isprime+0x65>
movl   $0x1,-0x4(%rbp)
jmp    116c <isprime+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprime>:
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%esi
mov    %edi,%eax
cltd
idiv   %ecx
lea    0x1(%rsi),%ecx
cmp    %edi,%esi
jg     1122 <isprime+0x22>
test   %edx,%edx
jne    1110 <isprime+0x10>
sub    %edi,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @isprime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 2, i32* %4
br label %5
5: ; preds = %16, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp sle i32 %11, %12
br label %14
14: ; preds = %10, %5
%15 = phi i1 [ false, %5 ], [ %13, %10 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %5
19: ; preds = %14
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 1, i32* %2
br label %25
24: ; preds = %19
store i32 0, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @isprime(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 2, %1 ], [ %8, %2 ]
%4 = srem i32 %0, %3
%5 = icmp ne i32 %4, 0
%6 = icmp sle i32 %3, %0
%7 = and i1 %6, %5
%8 = add nuw nsw i32 %3, 1
br i1 %7, label %2, label %9
9: ; preds = %2
%10 = icmp eq i32 %3, %0
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
double ceil(double);
double floor(double);
double fix(double x) {
  if (x >= 0.) {
    return floor(x);
  } else {
    return ceil(x);
  }
}


x86 assembly (clang, -O0):
<fix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1153 <fix+0x33>
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1162 <fix+0x42>
movsd  -0x10(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    112f <fix+0xf>
jmp    1030 <ceil@plt>
jmp    1040 <floor@plt>

LLVM IR (-O0):
define double @fix(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = call double @llvm.floor.f64(double %7)
store double %8, double* %2
br label %12
9: ; preds = %1
%10 = load double, double* %3
%11 = call double @llvm.ceil.f64(double %10)
store double %11, double* %2
br label %12
12: ; preds = %9, %6
%13 = load double, double* %2
ret double %13
}

LLVM IR (-O2):
define double @fix(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call double @llvm.floor.f64(double %0)
br label %7
5: ; preds = %1
%6 = tail call double @llvm.ceil.f64(double %0)
br label %7
7: ; preds = %5, %3
%8 = phi double [ %4, %3 ], [ %6, %5 ]
ret double %8
}
/* Variables and functions */
scalar_t__ emalloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *estrdup(const char *s) {
  char *ns = (char *)emalloc(strlen(s) + 1);
  strcpy(ns, s);
  return ns;
}


x86 assembly (clang, -O0):
<estrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <emalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<estrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <emalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @estrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @emalloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @estrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @emalloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ mvaddch(int, int, int);
void window_draw_char(int x, int y, int value) { mvaddch(y, x, value); }


x86 assembly (clang, -O0):
<window_draw_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <mvaddch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<window_draw_char>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <mvaddch@plt>

LLVM IR (-O0):
define void @window_draw_char(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = load i32, i32* %6
%10 = call i32 @mvaddch(i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @window_draw_char(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @mvaddch(i32 %1, i32 %0, i32 %2)
ret void
}
const char *gp_port_message_codeset(const char *codeset) { return ""; }


x86 assembly (clang, -O0):
<gp_port_message_codeset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @gp_port_message_codeset(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @gp_port_message_codeset(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ch_crc32c_update(int /*<<< orphan*/ const *,
                                    int /*<<< orphan*/, int *);
uint32_t ch_crc32c(const uint8_t *s, uint64_t n) {
  uint32_t crc = 0xffffffffU;
  ch_crc32c_update(s, n, &crc);
  return crc ^ 0xffffffffU;
}


x86 assembly (clang, -O0):
<ch_crc32c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
call   1030 <ch_crc32c_update@plt>
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ch_crc32c>:
push   %rax
movl   $0xffffffff,0x4(%rsp)
ff
lea    0x4(%rsp),%rdx
call   1030 <ch_crc32c_update@plt>
mov    0x4(%rsp),%eax
not    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ch_crc32c(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* %4
%8 = call i32 @ch_crc32c_update(i32* %6, i32 %7, i32* %5)
%9 = load i32, i32* %5
%10 = xor i32 %9, -1
ret i32 %10
}

LLVM IR (-O2):
define i32 @ch_crc32c(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%5 = call i32 @ch_crc32c_update(i32* %0, i32 %1, i32* %3)
%6 = load i32, i32* %3
%7 = xor i32 %6, -1
ret i32 %7
}
void deadchild(int sig) {}


x86 assembly (clang, -O0):
<deadchild>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @deadchild(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ const *);
int /*<<< orphan*/ strftime(char *, int, char const *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_arpadate(char *d_string) {
  struct tm *date;
  time_t now;
  const char *format = "%a, %_d %b %Y %H:%M:%S %z";
  now = time(NULL);
  date = localtime((const time_t *)&now);
  (void)strftime(d_string, 32, format, date);
}


x86 assembly (clang, -O0):
<get_arpadate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x20,%esi
call   1050 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_arpadate>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xeac(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [26 x i8] c"%a, %_d %b %Y %H:%M:%S %z\00"
define void @get_arpadate(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = call i32 @time(i32* null)
store i32 %6, i32* %4
%7 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %7, %struct.tm** %3
%8 = load i8*, i8** %2
%9 = load i8*, i8** %5
%10 = load %struct.tm*, %struct.tm** %3
%11 = call i32 @strftime(i8* %8, i32 32, i8* %9, %struct.tm* %10)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [26 x i8] c"%a, %_d %b %Y %H:%M:%S %z\00"
define void @get_arpadate(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call %struct.tm* @localtime(i32* %2)
%6 = call i32 @strftime(i8* %0, i32 32, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret void
}
int charToInt(char c) {
  int yes = -1;
  char numChar[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
  int numInt[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  for (int i = 0; i <= 10; ++i) {
    if (c == numChar[i]) {
      yes = numInt[i];
      break;
    }
  }
  return yes;
}


x86 assembly (clang, -O0):
<charToInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xed1(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jg     1199 <charToInt+0x89>
movsbl -0x1(%rbp),%eax
movslq -0x44(%rbp),%rcx
movsbl -0x12(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1186 <charToInt+0x76>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <charToInt+0x89>
jmp    118b <charToInt+0x7b>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1157 <charToInt+0x47>
mov    -0x8(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charToInt>:
add    $0xd0,%dil
mov    $0xffffffff,%eax
cmp    $0x9,%dil
ja     111d <charToInt+0x1d>
movzbl %dil,%eax
lea    0xee6(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@__const.charToInt.numChar = [10 x i8] c"0123456789"
@__const.charToInt.numInt = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
define i32 @charToInt(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca [10 x i32]
%6 = alloca i32
store i8 %0, i8* %2
store i32 -1, i32* %3
%7 = bitcast [10 x i8]* %4 to i8*
%8 = bitcast [10 x i32]* %5 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %27, %1
%10 = load i32, i32* %6
%11 = icmp sle i32 %10, 10
br i1 %11, label %12, label %30
12: ; preds = %9
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %14, %19
br i1 %20, label %21, label %26
21: ; preds = %12
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %23
%25 = load i32, i32* %24
store i32 %25, i32* %3
br label %30
26: ; preds = %12
br label %27
27: ; preds = %26
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %9
30: ; preds = %21, %9
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@__const.charToInt.numInt = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
define i32 @charToInt(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = zext i8 %2 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.charToInt.numInt, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}
void ctest1(int *i) { *i = 100; }


x86 assembly (clang, -O0):
<ctest1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x64,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctest1>:
movl   $0x64,(%rdi)
ret

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

LLVM IR (-O2):
define void @ctest1(i32* nocapture writeonly %0) {
store i32 100, i32* %0
ret void
}
/* Variables and functions */
long gcd(long, long);
long lcm(long a, long b) { return a * b / gcd(a, b); }


x86 assembly (clang, -O0):
<lcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cqto
idiv   %rcx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm>:
push   %rbx
mov    %rsi,%rbx
imul   %rdi,%rbx
call   1030 <gcd@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1133 <lcm+0x23>
mov    %rbx,%rax
cqto
idiv   %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i64 @lcm(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 = mul nsw i64 %5, %6
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = call i64 @gcd(i64 %8, i64 %9)
%11 = sdiv i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @lcm(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
%4 = tail call i64 @gcd(i64 %0, i64 %1)
%5 = sdiv i64 %3, %4
ret i64 %5
}
double f4_sum_pre_double_double_float(double v0, double v1, float v) {
  return v0 + v1 + ((double)(v));
}


x86 assembly (clang, -O0):
<f4_sum_pre_double_double_float>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_sum_pre_double_double_float>:
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4_sum_pre_double_double_float(double %0, double %1, float %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca float
store double %0, double* %4
store double %1, double* %5
store float %2, float* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fadd double %7, %8
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = fadd double %9, %11
ret double %12
}

LLVM IR (-O2):
define double @f4_sum_pre_double_double_float(double %0, double %1, float %2) {
%4 = fadd double %0, %1
%5 = fpext float %2 to double
%6 = fadd double %4, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void raise_sig(void) { raise(SIGINT); }


x86 assembly (clang, -O0):
<raise_sig>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<raise_sig>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <raise@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
define void @raise_sig() {
%1 = load i32, i32* @SIGINT
%2 = call i32 @raise(i32 %1)
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
define void @raise_sig() {
%1 = load i32, i32* @SIGINT
%2 = tail call i32 @raise(i32 %1)
ret void
}
char test_55_0(char *mem) { return __atomic_fetch_or(mem + 4, 1, 4); }


x86 assembly (clang, -O0):
<test_55_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,-0xc(%rbp)
mov    0x4(%rax),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%sil
mov    %al,%dl
or     %sil,%dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xb(%rbp)
jne    1152 <test_55_0+0x52>
jmp    1127 <test_55_0+0x27>
mov    -0x19(%rbp),%al
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_55_0>:
mov    0x4(%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
or     $0x1,%cl
lock cmpxchg %cl,0x4(%rdi)
jne    1110 <test_55_0+0x10>
ret

LLVM IR (-O0):
define signext i8 @test_55_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 4
store i8 1, i8* %3
%7 = load i8, i8* %3
%8 = atomicrmw or i8* %6, i8 %7 acq_rel
store i8 %8, i8* %4
%9 = load i8, i8* %4
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @test_55_0(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 4
%3 = atomicrmw or i8* %2, i8 1 acq_rel
ret i8 %3
}
void foo434(int p) {}


x86 assembly (clang, -O0):
<foo434>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo434(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_stream_get_timing_info() {
  printf("NOT IMPLEMENTED:"
         "pa_stream_get_timing_info"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"NOT IMPLEMENTED:pa_stream_get_timing_info\0A\00"
define i32 @pa_stream_get_timing_info() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [42 x i8] c"NOT IMPLEMENTED:pa_stream_get_timing_info\00"
define i32 @pa_stream_get_timing_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void outsb(unsigned short port, void *buf, int len) {
  asm volatile("rep outsb %%ds:(%0), %3"
               : "=S"(buf), "=c"(len)
               : "m"(buf), "Nd"(port), "0"(buf), "1"(len));
}


x86 assembly (clang, -O0):
<outsb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
rep outsb %ds:(%rsi),(%dx)
mov    %rsi,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsb>:
mov    %edx,%ecx
mov    %rsi,-0x8(%rsp)
mov    %edi,%edx
rep outsb %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsb(i16 zeroext %0, i8* %1, i32 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i32
store i16 %0, i16* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i16, i16* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call { i8*, i32 } asm sideeffect "rep outsb %ds:($0), $3", "={si},={cx},*m,N{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i8** elementtype(i8*) %5, i16 %7, i8* %8, i32 %9)
%11 = extractvalue { i8*, i32 } %10, 0
%12 = extractvalue { i8*, i32 } %10, 1
store i8* %11, i8** %5
store i32 %12, i32* %6
ret void
}

LLVM IR (-O2):
define void @outsb(i16 zeroext %0, i8* %1, i32 %2) {
%4 = alloca i8*
store i8* %1, i8** %4
%5 = call { i8*, i32 } asm sideeffect "rep outsb %ds:($0), $3", "={si},={cx},*m,N{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i8** elementtype(i8*) %4, i16 %0, i8* %1, i32 %2)
ret void
}
void I_NoAppServicesUpdate(void) {}


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

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

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

LLVM IR (-O2):
define void @I_NoAppServicesUpdate() {
ret void
}
/* Type definitions */
struct taskstats {
  int /*<<< orphan*/ nivcsw;
  int /*<<< orphan*/ nvcsw;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
void task_context_switch_counts(struct taskstats *t) {
  printf("\n\nTask   %15s%15s\n"
         "       %15llu%15llu\n",
         "voluntary", "nonvoluntary", t->nvcsw, t->nivcsw);
}


x86 assembly (clang, -O0):
<task_context_switch_counts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%r8d
lea    0xecf(%rip),%rdi
lea    0xef2(%rip),%rsi
lea    0xee8(%rip),%rdx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<task_context_switch_counts>:
mov    (%rdi),%r8d
mov    0x4(%rdi),%ecx
lea    0xee3(%rip),%rdi
lea    0xf06(%rip),%rsi
lea    0xefc(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.taskstats = type { i32, i32 }
@.str = [39 x i8] c"\0A\0ATask %15s%15s\0A %15llu%15llu\0A\00"
@.str.1 = [10 x i8] c"voluntary\00"
@.str.2 = [13 x i8] c"nonvoluntary\00"
define void @task_context_switch_counts(%struct.taskstats* %0) {
%2 = alloca %struct.taskstats*
store %struct.taskstats* %0, %struct.taskstats** %2
%3 = load %struct.taskstats*, %struct.taskstats** %2
%4 = getelementptr inbounds %struct.taskstats, %struct.taskstats* %3, i32 0, i32 1
%5 = load i32, i32* %4
%6 = load %struct.taskstats*, %struct.taskstats** %2
%7 = getelementptr inbounds %struct.taskstats, %struct.taskstats* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.taskstats = type { i32, i32 }
@.str = [39 x i8] c"\0A\0ATask %15s%15s\0A %15llu%15llu\0A\00"
@.str.1 = [10 x i8] c"voluntary\00"
@.str.2 = [13 x i8] c"nonvoluntary\00"
define void @task_context_switch_counts(%struct.taskstats* nocapture %0) {
%2 = getelementptr inbounds %struct.taskstats, %struct.taskstats* %0, i64 0, i32 1
%3 = load i32, i32* %2
%4 = getelementptr inbounds %struct.taskstats, %struct.taskstats* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MCUSendCmdShockDetectionSensitivity(int);
void MCUSendCmdShockDetectionSensitivityH() {
  MCUSendCmdShockDetectionSensitivity(0x02);
}


x86 assembly (clang, -O0):
<MCUSendCmdShockDetectionSensitivityH>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <MCUSendCmdShockDetectionSensitivity@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MCUSendCmdShockDetectionSensitivityH>:
mov    $0x2,%edi
jmp    1030 <MCUSendCmdShockDetectionSensitivity@plt>

LLVM IR (-O0):
define void @MCUSendCmdShockDetectionSensitivityH() {
%1 = call i32 @MCUSendCmdShockDetectionSensitivity(i32 2)
ret void
}

LLVM IR (-O2):
define void @MCUSendCmdShockDetectionSensitivityH() {
%1 = tail call i32 @MCUSendCmdShockDetectionSensitivity(i32 2)
ret void
}
int mik_isprint(int c) { return (c >= 0x20 && c <= 0x7e); }


x86 assembly (clang, -O0):
<mik_isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <mik_isprint+0x20>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mik_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @mik_isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @mik_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}