xunge/DecIR huggingface dataset:
unsigned long int fibonacci(unsigned long int pos) {
  if (pos == 0) {
    return 0;
  } else if (pos == 1) {
    return 1;
  } else
    return fibonacci(pos - 1) + fibonacci(pos - 2);
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <fibonacci+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1178 <fibonacci+0x68>
cmpq   $0x1,-0x10(%rbp)
jne    114c <fibonacci+0x3c>
movq   $0x1,-0x8(%rbp)
jmp    1178 <fibonacci+0x68>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fibonacci@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
cmp    $0x2,%rbx
jb     1136 <fibonacci+0x26>
lea    -0x1(%rbx),%rdi
call   1030 <fibonacci@plt>
add    %rax,%r14
add    $0xfffffffffffffffe,%rbx
cmp    $0x2,%rbx
jae    1120 <fibonacci+0x10>
add    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibonacci(i64 %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i64 [ 0, %1 ], [ %10, %6 ]
%4 = phi i64 [ %0, %1 ], [ %9, %6 ]
%5 = icmp ult i64 %4, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = add i64 %4, -1
%8 = tail call i64 @fibonacci(i64 %7)
%9 = add i64 %4, -2
%10 = add i64 %8, %3
br label %2
11: ; preds = %2
%12 = add i64 %4, %3
ret i64 %12
}
void zeroout(char a[]) {
  int i = 0;
  while (a[i] != '\0')
    a[i++] = 0;
}


x86 assembly (clang, -O0):
<zeroout>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     113f <zeroout+0x3f>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    110f <zeroout+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeroout>:
cmpb   $0x0,(%rdi)
je     111d <zeroout+0x1d>
add    $0x1,%rdi
nopl   0x0(%rax)
movb   $0x0,-0x1(%rdi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <zeroout+0x10>
ret

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

LLVM IR (-O2):
define void @zeroout(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i64 %5, 1
store i8 0, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
char *strstr(char const *, char const *);
int stringOfSubstring(const char *s1, const char *s2) {
  int count = 0;
  while ((s1 = strstr(s1, s2)) != NULL) {
    count++;
    s1++;
  }
  return count;
}


x86 assembly (clang, -O0):
<stringOfSubstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     115c <stringOfSubstring+0x4c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1127 <stringOfSubstring+0x17>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringOfSubstring>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <strstr@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1147 <stringOfSubstring+0x37>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
add    $0x1,%rax
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strstr@plt>
test   %rax,%rax
jne    1130 <stringOfSubstring+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @stringOfSubstring(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %10, %5 ], [ %3, %2 ]
%7 = phi i32 [ %8, %5 ], [ 0, %2 ]
%8 = add nuw nsw i32 %7, 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @strstr(i8* dereferenceable(1) %9, i8* dereferenceable(1) %1)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %8, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int k;
  k = 0;
#pragma xmp task on p[0 : 4 : 2][1 : 2]
  { k = 1; }
#pragma xmp task on p[0 : 4 : 2][1 : 2] nocomm
  { k = 0; }
#pragma xmp reduction(+ : k)
#pragma xmp task on p[0][0]
  {
    if (k != 0) {
      printf("ERROR\n");
      exit(1);
    }
  }
  k = 0;
#pragma xmp task on t[1][1]
  { k = 1; }
#pragma xmp task on t[1][1] nocomm
  { k = 0; }
#pragma xmp reduction(+ : k)
#pragma xmp task on p[0][0]
  {
    if (k != 0) {
      printf("ERROR\n");
      exit(1);
    } else {
      printf("PASS\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1164 <main+0x44>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1199 <main+0x79>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
lea    0xe67(%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 = [7 x i8] c"ERROR\0A\00"
@.str.1 = [6 x i8] c"PASS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %2
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
store i32 0, i32* %2
store i32 1, i32* %2
store i32 0, i32* %2
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"PASS\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int sendClientClose();
int game_close() { return sendClientClose(); }


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

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

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

LLVM IR (-O2):
define i32 @game_close() {
%1 = tail call i32 (...) @sendClientClose()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int foo(int flag) {
  puts("foo");
  return flag;
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define i32 @foo(i32 returned %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %0
}
int sh_bios_in_gdb_mode(void) {
  static int gdb_active = -1;
  if (gdb_active == -1) {
    int (*set_console_comm)(int);
    set_console_comm = ((void **)0xfffe20)[13];
    gdb_active = (set_console_comm(-1) == -3);
  }
  return gdb_active;
}


x86 assembly (clang, -O0):
<sh_bios_in_gdb_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0xffffffff,0x2f11(%rip)
jne    113b <sh_bios_in_gdb_mode+0x3b>
mov    $0xfffe20,%eax
mov    0x68(%rax),%rax
mov    %rax,-0x8(%rbp)
mov    $0xffffffff,%edi
call   *-0x8(%rbp)
cmp    $0xfffffffd,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,0x2ee5(%rip)
mov    0x2edf(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sh_bios_in_gdb_mode>:
push   %rax
mov    0x2f19(%rip),%eax
cmp    $0xffffffff,%eax
je     110e <sh_bios_in_gdb_mode+0xe>
pop    %rcx
ret
mov    $0xffffffff,%edi
call   *0xfffe88
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xfffffffd,%ecx
sete   %al
mov    %eax,0x2ef6(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@sh_bios_in_gdb_mode.gdb_active = internal global i32 -1
define i32 @sh_bios_in_gdb_mode() {
%1 = alloca i32 (i32)*
%2 = load i32, i32* @sh_bios_in_gdb_mode.gdb_active
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = load i8*, i8** getelementptr inbounds (i8*, i8** inttoptr (i64 16776736 to i8**), i64 13)
%6 = bitcast i8* %5 to i32 (i32)*
store i32 (i32)* %6, i32 (i32)** %1
%7 = load i32 (i32)*, i32 (i32)** %1
%8 = call i32 %7(i32 -1)
%9 = icmp eq i32 %8, -3
%10 = zext i1 %9 to i32
store i32 %10, i32* @sh_bios_in_gdb_mode.gdb_active
br label %11
11: ; preds = %4, %0
%12 = load i32, i32* @sh_bios_in_gdb_mode.gdb_active
ret i32 %12
}

LLVM IR (-O2):
@sh_bios_in_gdb_mode.gdb_active = internal unnamed_addr global i32 -1
define i32 @sh_bios_in_gdb_mode() {
%1 = load i32, i32* @sh_bios_in_gdb_mode.gdb_active
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32 (i32)*, i32 (i32)** inttoptr (i64 16776840 to i32 (i32)**)
%5 = tail call i32 %4(i32 -1)
%6 = icmp eq i32 %5, -3
%7 = zext i1 %6 to i32
store i32 %7, i32* @sh_bios_in_gdb_mode.gdb_active
br label %8
8: ; preds = %3, %0
%9 = phi i32 [ %7, %3 ], [ %1, %0 ]
ret i32 %9
}
void f2(void) {
  char buf[512];
  asm volatile("" : : "g"(&buf) : "memory");
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
lea    -0x200(%rbp),%rax
mov    %rax,-0x208(%rbp)
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
sub    $0x198,%rsp
lea    -0x70(%rsp),%rax
mov    %rax,-0x78(%rsp)
add    $0x198,%rsp
ret

LLVM IR (-O0):
define void @f2() {
%1 = alloca [512 x i8]
ret void
}

LLVM IR (-O2):
define void @f2() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
ret void
}
int test_imm_6Aint8_reg(signed char val) {
  return ((val) & (-0x6A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Aint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff96,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Aint8_reg>:
test   $0x96,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_6Aint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -106
%6 = icmp ne i32 %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_6Aint8_reg(i8 signext %0) {
%2 = and i8 %0, -106
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stdout;
int greatest_string_printf_cb(const void *t, void *udata) {
  (void)udata;
  return fprintf(stdout, "%s", (const char *)t);
}


x86 assembly (clang, -O0):
<greatest_string_printf_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<greatest_string_printf_cb>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @greatest_string_printf_cb(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* @stdout
%7 = load i8*, i8** %3
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @greatest_string_printf_cb(i8* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %4
}
/* Variables and functions */
double remove_event_entry(int);
double remove_event_doc(int osc) { return remove_event_entry(4 + (osc << 8)); }


x86 assembly (clang, -O0):
<remove_event_doc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x8,%edi
add    $0x4,%edi
call   1030 <remove_event_entry@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_event_doc>:
shl    $0x8,%edi
or     $0x4,%edi
jmp    1030 <remove_event_entry@plt>

LLVM IR (-O0):
define double @remove_event_doc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = add nsw i32 4, %4
%6 = call double @remove_event_entry(i32 %5)
ret double %6
}

LLVM IR (-O2):
define double @remove_event_doc(i32 %0) {
%2 = shl i32 %0, 8
%3 = or i32 %2, 4
%4 = tail call double @remove_event_entry(i32 %3)
ret double %4
}
/* Variables and functions */
scalar_t__ in_set(char, char *);
char upcase(char a) {
  if (in_set(a, "abcdefghijklmnopqrstuvwxyz")) {
    a = a - 32;
  }
  return a;
}


x86 assembly (clang, -O0):
<upcase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rsi
movsbl -0x1(%rbp),%edi
call   1030 <in_set@plt>
cmp    $0x0,%rax
je     1142 <upcase+0x32>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upcase>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rsi
call   1030 <in_set@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
define signext i8 @upcase(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @in_set(i8 signext %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 32
%10 = trunc i32 %9 to i8
store i8 %10, i8* %2
br label %11
11: ; preds = %6, %1
%12 = load i8, i8* %2
ret i8 %12
}

LLVM IR (-O2):
@.str = [27 x i8] c"abcdefghijklmnopqrstuvwxyz\00"
define signext i8 @upcase(i8 signext %0) {
%2 = tail call i64 @in_set(i8 signext %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
void Lut_2(double *out, double *in) {
  out[0] = in[0];
  out[1] = in[1];
}


x86 assembly (clang, -O0):
<Lut_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lut_2>:
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @Lut_2(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %3
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
ret void
}

LLVM IR (-O2):
define void @Lut_2(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
store double %3, double* %0
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 1
store double %5, double* %6
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
bool RingCompareLe(uint32_t a, uint32_t b) { return (int32_t)(a - b) <= 0; }


x86 assembly (clang, -O0):
<RingCompareLe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
cmp    $0x0,%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RingCompareLe>:
xor    %eax,%eax
cmp    %rsi,%rdi
setle  %al
ret

LLVM IR (-O0):
define i32 @RingCompareLe(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 = sub nsw i64 %5, %6
%8 = icmp sle i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @RingCompareLe(i64 %0, i64 %1) {
%3 = icmp sle i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int done(void) {}


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

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

LLVM IR (-O0):
define i32 @done() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @done() {
ret i32 undef
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t well_known_flags(uint64_t flags) {
  flags &= ~(0xffffULL << 32);
  if ((flags & ((1ULL << 15) | (1ULL << 16))) && !(flags & (1ULL << 17)))
    flags &= ~((1ULL << 15) | (1ULL << 16));
  return flags;
}


x86 assembly (clang, -O0):
<well_known_flags>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xffff0000ffffffff,%rcx
and    %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
and    $0x18000,%rax
cmp    $0x0,%rax
je     1150 <well_known_flags+0x50>
movslq -0x4(%rbp),%rax
and    $0x20000,%rax
cmp    $0x0,%rax
jne    1150 <well_known_flags+0x50>
movslq -0x4(%rbp),%rax
and    $0xfffffffffffe7fff,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<well_known_flags>:
mov    %edi,%ecx
mov    %edi,%eax
and    $0xfffe7fff,%eax
test   $0x20000,%ecx
cmovne %edi,%eax
test   $0x18000,%ecx
cmove  %edi,%eax
ret

LLVM IR (-O0):
define i32 @well_known_flags(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = and i64 %4, -281470681743361
%6 = trunc i64 %5 to i32
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = and i64 %8, 98304
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %1
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = and i64 %13, 131072
%15 = icmp ne i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = and i64 %18, -98305
%20 = trunc i64 %19 to i32
store i32 %20, i32* %2
br label %21
21: ; preds = %16, %11, %1
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @well_known_flags(i32 %0) {
%2 = zext i32 %0 to i64
%3 = and i64 %2, 98304
%4 = icmp ne i64 %3, 0
%5 = and i64 %2, 131072
%6 = icmp eq i64 %5, 0
%7 = and i1 %4, %6
%8 = and i32 %0, -98305
%9 = select i1 %7, i32 %8, i32 %0
ret i32 %9
}
/* Variables and functions */
char *strdup(char const *);
char *strrchr(char *, char);
char *ascend(const char *path_str) {
  char *path, *last_slash;
  path = strdup(path_str);
  last_slash = strrchr(path, '/');
  if (last_slash != path) {
    *last_slash = '\0';
  } else
    *(last_slash + 1) = '\0';
  return path;
}


x86 assembly (clang, -O0):
<ascend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1165 <ascend+0x45>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
jmp    116d <ascend+0x4d>
mov    -0x18(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascend>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rbx),%rcx
cmp    %rbx,%rax
cmovne %rax,%rcx
movb   $0x0,(%rcx)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @ascend(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %2, i8 signext 47)
%4 = icmp eq i8* %3, %2
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = select i1 %4, i8* %5, i8* %3
store i8 0, i8* %6
ret i8* %2
}
char *strcpy(char *dst, const char *src) {
  char *ret = dst;
  while (*dst++ = *src++)
    ;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
int test_abs(int x) { return (x < 0) ? -x : x; }


x86 assembly (clang, -O0):
<test_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <test_abs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <test_abs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @test_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
void WatchdogLock(void) {
  (*((volatile unsigned long *)(0x40080000 + 0x00000C00))) = 0x00000001;
}


x86 assembly (clang, -O0):
<WatchdogLock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40080c00,%eax
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogLock>:
movq   $0x1,0x40080c00
ret

LLVM IR (-O0):
define void @WatchdogLock() {
store volatile i64 1, i64* inttoptr (i64 1074269184 to i64*)
ret void
}

LLVM IR (-O2):
define void @WatchdogLock() {
store volatile i64 1, i64* inttoptr (i64 1074269184 to i64*)
ret void
}
/* Variables and functions */
float tf2(double a) { return a; }


x86 assembly (clang, -O0):
<tf2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf2>:
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @tf2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptrunc double %3 to float
ret float %4
}

LLVM IR (-O2):
define float @tf2(double %0) {
%2 = fptrunc double %0 to float
ret float %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void latex_invoice_output_header(FILE *output_stream) {
  fprintf(output_stream, "\\documentclass{letter}\n"
                         "\\usepackage{longtable}\n"
                         "\\usepackage{graphics}\n"
                         "\\usepackage[	margin=1in,\n"
                         "		nohead]{geometry}\n"
                         "\\begin{document}\n");
}


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

x86 assembly (clang, -O2):
<latex_invoice_output_header>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x82,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [131 x i8] c"\\documentclass{letter}\0A\\usepackage{longtable}\0A\\usepackage{graphics}\0A\\usepackage[\09margin=1in,\0A\09\09nohead]{geometry}\0A\\begin{document}\0A\00"
define void @latex_invoice_output_header(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [131 x i8] c"\\documentclass{letter}\0A\\usepackage{longtable}\0A\\usepackage{graphics}\0A\\usepackage[\09margin=1in,\0A\09\09nohead]{geometry}\0A\\begin{document}\0A\00"
define void @latex_invoice_output_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0), i64 130, i64 1, i32* %0)
ret void
}
int do_874() { return 874; }


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

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

LLVM IR (-O0):
define i32 @do_874() {
ret i32 874
}

LLVM IR (-O2):
define i32 @do_874() {
ret i32 874
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__43__IO__selectIOFunc();
void Msp430Adc12ImplP__Port63__selectIOFunc(void) {
  HplMsp430GeneralIOP__43__IO__selectIOFunc();
}


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

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

LLVM IR (-O0):
define void @Msp430Adc12ImplP__Port63__selectIOFunc() {
%1 = call i32 (...) @HplMsp430GeneralIOP__43__IO__selectIOFunc()
ret void
}

LLVM IR (-O2):
define void @Msp430Adc12ImplP__Port63__selectIOFunc() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__43__IO__selectIOFunc()
ret void
}
/* Variables and functions */
int __builtin_ptx_read_ntid_w();
int __builtin_ptx_read_ntid_x();
int __builtin_ptx_read_ntid_y();
int __builtin_ptx_read_ntid_z();
int read_ntid() {
  int x = __builtin_ptx_read_ntid_x();
  int y = __builtin_ptx_read_ntid_y();
  int z = __builtin_ptx_read_ntid_z();
  int w = __builtin_ptx_read_ntid_w();
  return x + y + z + w;
}


x86 assembly (clang, -O0):
<read_ntid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__builtin_ptx_read_ntid_x@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <__builtin_ptx_read_ntid_y@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__builtin_ptx_read_ntid_z@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <__builtin_ptx_read_ntid_w@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ntid>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <__builtin_ptx_read_ntid_x@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <__builtin_ptx_read_ntid_y@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <__builtin_ptx_read_ntid_z@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <__builtin_ptx_read_ntid_w@plt>
add    %r14d,%ebp
add    %ebx,%ebp
add    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_ntid() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @__builtin_ptx_read_ntid_x()
store i32 %5, i32* %1
%6 = call i32 (...) @__builtin_ptx_read_ntid_y()
store i32 %6, i32* %2
%7 = call i32 (...) @__builtin_ptx_read_ntid_z()
store i32 %7, i32* %3
%8 = call i32 (...) @__builtin_ptx_read_ntid_w()
store i32 %8, i32* %4
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @read_ntid() {
%1 = tail call i32 (...) @__builtin_ptx_read_ntid_x()
%2 = tail call i32 (...) @__builtin_ptx_read_ntid_y()
%3 = tail call i32 (...) @__builtin_ptx_read_ntid_z()
%4 = tail call i32 (...) @__builtin_ptx_read_ntid_w()
%5 = add nsw i32 %2, %1
%6 = add nsw i32 %5, %3
%7 = add nsw i32 %6, %4
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_number_error(char *n) {
  printf("\x1B[31m"
         "invalid number <%s>\n"
         "\x1B[0m",
         n);
}


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

x86 assembly (clang, -O2):
<print_number_error>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\1B[31minvalid number <%s>\0A\1B[0m\00"
define void @print_number_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"\1B[31minvalid number <%s>\0A\1B[0m\00"
define void @print_number_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int context_equal(void *cxt1, void *cxt2) {
  if (cxt1 == cxt2)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<context_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <context_equal+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <context_equal+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<context_equal>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
ret

LLVM IR (-O0):
define i32 @context_equal(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = icmp eq i8* %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %11
10: ; preds = %2
store i32 1, i32* %3
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @context_equal(i8* readnone %0, i8* readnone %1) {
%3 = icmp ne i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int f1(int *p_58) { return *p_58; }


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

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

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

LLVM IR (-O2):
define i32 @f1(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Type definitions */
struct pool {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pool_new_strn(struct pool *, char const *, int);
int xml_node_add_text_id(int, int /*<<< orphan*/, struct pool *);
int xml_node_add_textn(int node, int len, const char *text, struct pool *p) {
  return xml_node_add_text_id(node, pool_new_strn(p, text, len), p);
}


x86 assembly (clang, -O0):
<xml_node_add_textn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%edx
call   1040 <pool_new_strn@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
call   1030 <xml_node_add_text_id@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xml_node_add_textn>:
push   %rbp
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %esi,%eax
mov    %edi,%ebp
mov    %rcx,%rdi
mov    %rdx,%rsi
mov    %eax,%edx
call   1040 <pool_new_strn@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <xml_node_add_text_id@plt>

LLVM IR (-O0):
%struct.pool = type { i32 }
define i32 @xml_node_add_textn(i32 %0, i32 %1, i8* %2, %struct.pool* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.pool*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store %struct.pool* %3, %struct.pool** %8
%9 = load i32, i32* %5
%10 = load %struct.pool*, %struct.pool** %8
%11 = load i8*, i8** %7
%12 = load i32, i32* %6
%13 = call i32 @pool_new_strn(%struct.pool* %10, i8* %11, i32 %12)
%14 = load %struct.pool*, %struct.pool** %8
%15 = call i32 @xml_node_add_text_id(i32 %9, i32 %13, %struct.pool* %14)
ret i32 %15
}

LLVM IR (-O2):
%struct.pool = type { i32 }
define i32 @xml_node_add_textn(i32 %0, i32 %1, i8* %2, %struct.pool* %3) {
%5 = tail call i32 @pool_new_strn(%struct.pool* %3, i8* %2, i32 %1)
%6 = tail call i32 @xml_node_add_text_id(i32 %0, i32 %5, %struct.pool* %3)
ret i32 %6
}
int divide_power2(int x, int k) {
  int mask = x >> ((sizeof(int) << 3) - 1);
  int bias = mask & ((1 << k) - 1);
  return (x + bias) >> k;
}


x86 assembly (clang, -O0):
<divide_power2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide_power2>:
mov    %esi,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
not    %edx
mov    %edi,%eax
sar    $0x1f,%eax
and    %edx,%eax
add    %edi,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @divide_power2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = ashr i32 %7, 31
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = sub nsw i32 %11, 1
%13 = and i32 %9, %12
store i32 %13, i32* %6
%14 = load i32, i32* %3
%15 = load i32, i32* %6
%16 = add nsw i32 %14, %15
%17 = load i32, i32* %4
%18 = ashr i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @divide_power2(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = icmp slt i32 %0, 0
%6 = select i1 %5, i32 %4, i32 0
%7 = add nsw i32 %6, %0
%8 = ashr i32 %7, %1
ret i32 %8
}
/* Variables and functions */
unsigned long long get_time();
unsigned long busy_loop(unsigned long long start_time) {
  unsigned long long time;
  unsigned long l = 0;
  do {
    l++;
    time = get_time();
  } while ((time - start_time) < (20ULL * 1000000ULL));
  return l;
}


x86 assembly (clang, -O0):
<busy_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <get_time@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cmp    $0x1312d00,%rax
jb     1124 <busy_loop+0x14>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<busy_loop>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
add    $0x1,%rbx
xor    %eax,%eax
call   1030 <get_time@plt>
sub    %r14,%rax
cmp    $0x1312d00,%rax
jb     1120 <busy_loop+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @busy_loop(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %4
br label %5
5: ; preds = %9, %1
%6 = load i64, i64* %4
%7 = add i64 %6, 1
store i64 %7, i64* %4
%8 = call i64 (...) @get_time()
store i64 %8, i64* %3
br label %9
9: ; preds = %5
%10 = load i64, i64* %3
%11 = load i64, i64* %2
%12 = sub i64 %10, %11
%13 = icmp ult i64 %12, 20000000
br i1 %13, label %5, label %14
14: ; preds = %9
%15 = load i64, i64* %4
ret i64 %15
}

LLVM IR (-O2):
define i64 @busy_loop(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %4, %2 ]
%4 = add i64 %3, 1
%5 = tail call i64 (...) @get_time()
%6 = sub i64 %5, %0
%7 = icmp ult i64 %6, 20000000
br i1 %7, label %2, label %8
8: ; preds = %2
ret i64 %4
}
/* Variables and functions */
scalar_t__ floor(double);
int day_of_week(double jd) {
  return (((int)floor(jd - 2433282 - 1.5) % 7) + 7) % 7;
}


x86 assembly (clang, -O0):
<day_of_week>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xede(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeca(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x7,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<day_of_week>:
push   %rax
addsd  0xee7(%rip),%xmm0
addsd  0xee7(%rip),%xmm0
call   1030 <floor@plt>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
add    $0x7,%cl
movzbl %cl,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @day_of_week(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 0x4142908100000000
%5 = fsub double %4, 1.500000e+00
%6 = call i64 @floor(double %5)
%7 = trunc i64 %6 to i32
%8 = srem i32 %7, 7
%9 = add nsw i32 %8, 7
%10 = srem i32 %9, 7
ret i32 %10
}

LLVM IR (-O2):
define i32 @day_of_week(double %0) {
%2 = fadd double %0, 0xC142908100000000
%3 = fadd double %2, -1.500000e+00
%4 = tail call i64 @floor(double %3)
%5 = trunc i64 %4 to i32
%6 = srem i32 %5, 7
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 7
%9 = urem i8 %8, 7
%10 = zext i8 %9 to i32
ret i32 %10
}
int MAN1() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @MAN1() {
ret i32 0
}
/* Variables and functions */
long long strtoll(char const *, char **, int);
int string_is_integer(const char *s, long long *integer_value) {
  char *endptr;
  *integer_value = strtoll(s, &endptr, 10);
  return !*endptr;
}


x86 assembly (clang, -O0):
<string_is_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_is_integer>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,(%rbx)
mov    0x8(%rsp),%rcx
xor    %eax,%eax
cmpb   $0x0,(%rcx)
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @string_is_integer(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca i8*
store i8* %0, i8** %3
store i64* %1, i64** %4
%6 = load i8*, i8** %3
%7 = call i64 @strtoll(i8* %6, i8** %5, i32 10)
%8 = load i64*, i64** %4
store i64 %7, i64* %8
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @string_is_integer(i8* %0, i64* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @strtoll(i8* %0, i8** %3, i32 10)
store i64 %5, i64* %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
double const mulsign(int, double);
__attribute__((always_)) const double sign(double d) { return mulsign(1, d); }


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <mulsign@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
mov    $0x1,%edi
jmp    1030 <mulsign@plt>

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

LLVM IR (-O2):
define double @sign(double %0) {
%2 = tail call double @mulsign(i32 1, double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ dologout(int /*<<< orphan*/);
int /*<<< orphan*/ reply(int, char *, ...);
void opiefatal(char *s) {
  reply(451, "Error in server: %s\n", s);
  reply(221, "Closing connection due to server error.");
  dologout(0);
}


x86 assembly (clang, -O0):
<opiefatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1c3,%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1040 <reply@plt>
mov    $0xdd,%edi
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1040 <reply@plt>
xor    %edi,%edi
call   1030 <dologout@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opiefatal>:
push   %rax
mov    %rdi,%rdx
lea    0xed5(%rip),%rsi
mov    $0x1c3,%edi
xor    %eax,%eax
call   1040 <reply@plt>
lea    0xed7(%rip),%rsi
mov    $0xdd,%edi
xor    %eax,%eax
call   1040 <reply@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <dologout@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Error in server: %s\0A\00"
@.str.1 = [40 x i8] c"Closing connection due to server error.\00"
define void @opiefatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i32, i8*, ...) @reply(i32 451, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i32, i8*, ...) @reply(i32 221, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @dologout(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Error in server: %s\0A\00"
@.str.1 = [40 x i8] c"Closing connection due to server error.\00"
define void @opiefatal(i8* %0) {
%2 = tail call i32 (i32, i8*, ...) @reply(i32 451, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i32, i8*, ...) @reply(i32 221, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @dologout(i32 0)
ret void
}