xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ primesum(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() { printf("The solution is: %li\n", primesum(2000000)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1e8480,%edi
call   1040 <primesum@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1e8480,%edi
call   1040 <primesum@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"The solution is: %li\0A\00"
define i32 @main() {
%1 = call i32 @primesum(i32 2000000)
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"The solution is: %li\0A\00"
define i32 @main() {
%1 = tail call i32 @primesum(i32 2000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
char pkt_frametype_to_char(int frametype) {
  if (frametype == 1)
    return 'I';
  if (frametype == 2)
    return 'P';
  if (frametype == 3)
    return 'B';
  return ' ';
}


x86 assembly (clang, -O0):
<pkt_frametype_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111a <pkt_frametype_to_char+0x1a>
movb   $0x49,-0x1(%rbp)
jmp    1144 <pkt_frametype_to_char+0x44>
cmpl   $0x2,-0x8(%rbp)
jne    112d <pkt_frametype_to_char+0x2d>
movb   $0x50,-0x1(%rbp)
jmp    1144 <pkt_frametype_to_char+0x44>
cmpl   $0x3,-0x8(%rbp)
jne    1140 <pkt_frametype_to_char+0x40>
movb   $0x42,-0x1(%rbp)
jmp    1144 <pkt_frametype_to_char+0x44>
movb   $0x20,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkt_frametype_to_char>:
lea    -0x8(,%rdi,8),%ecx
mov    %edi,%eax
add    $0xffffffff,%eax
mov    $0x425049,%edx
shr    %cl,%edx
cmp    $0x3,%eax
mov    $0x20,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @pkt_frametype_to_char(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i8 73, i8* %2
br label %16
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %7
store i8 80, i8* %2
br label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %15
14: ; preds = %11
store i8 66, i8* %2
br label %16
15: ; preds = %11
store i8 32, i8* %2
br label %16
16: ; preds = %15, %14, %10, %6
%17 = load i8, i8* %2
ret i8 %17
}

LLVM IR (-O2):
define signext i8 @pkt_frametype_to_char(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
%4 = trunc i32 %2 to i24
%5 = shl i24 %4, 3
%6 = lshr i24 4345929, %5
%7 = trunc i24 %6 to i8
%8 = select i1 %3, i8 %7, i8 32
ret i8 %8
}
char mytolower(char ch) {
  if (ch >= 'A' && ch <= 'Z') {
    return ch + 'a' - 'A';
  }
  return ch;
}


x86 assembly (clang, -O0):
<mytolower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <mytolower+0x36>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1136 <mytolower+0x36>
movsbl -0x2(%rbp),%eax
add    $0x61,%eax
sub    $0x41,%eax
mov    %al,-0x1(%rbp)
jmp    113c <mytolower+0x3c>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @mytolower(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
int isleap_(int year) {
  return year % 4 && (0 != year % 100 || 0 == year % 400);
}


x86 assembly (clang, -O0):
<isleap_>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0x5(%rbp)
je     1155 <isleap_+0x55>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
xor    %ecx,%ecx
cmp    %edx,%ecx
mov    %al,-0x6(%rbp)
jne    114f <isleap_+0x4f>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
sete   %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isleap_>:
test   $0x3,%dil
je     1125 <isleap_+0x25>
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
mov    $0x1,%eax
cmp    $0x28f5c28,%edx
jbe    1128 <isleap_+0x28>
ret
xor    %eax,%eax
ret
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
ret

LLVM IR (-O0):
define i32 @isleap_(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 4
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* %2
%8 = srem i32 %7, 100
%9 = icmp ne i32 0, %8
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = srem i32 %11, 400
%13 = icmp eq i32 0, %12
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ true, %6 ], [ %13, %10 ]
br label %16
16: ; preds = %14, %1
%17 = phi i1 [ false, %1 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @isleap_(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = srem i32 %0, 100
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = srem i32 %0, 400
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %7, %1
%12 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_startup_info(void) {
  printf("\n"
         "DNS Query Performance Testing Tool\n"
         "Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $\n"
         "\n");
}


x86 assembly (clang, -O0):
<show_startup_info>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [103 x i8] c"\0ADNS Query Performance Testing Tool\0AVersion: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $\0A\0A\00"
define void @show_startup_info() {
%1 = call i32 @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [102 x i8] c"\0ADNS Query Performance Testing Tool\0AVersion: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $\0A\00"
define void @show_startup_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @str, i64 0, i64 0))
ret void
}
int test_imm_02int16_reg(short val) {
  return ((val) & (0x02 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_02int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_02int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 2
%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_02int16_reg(i16 signext %0) {
%2 = and i16 %0, 2
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void setval_197(unsigned *p) { *p = 365006936U; }


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

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

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

LLVM IR (-O2):
define void @setval_197(i32* nocapture writeonly %0) {
store i32 365006936, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ draw_string(int /*<<< orphan*/, int, ...);
int /*<<< orphan*/ setup_video(int /*<<< orphan*/, int /*<<< orphan*/);
void error_bb(unsigned char *msg) {
  setup_video(0, 0);
  draw_string(0, 24, "dcload-ip 1.0.3", 0xffff);
  draw_string(0, 48, msg, 0xffff);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<error_bb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <setup_video@plt>
xor    %edi,%edi
mov    $0x18,%esi
lea    0xebd(%rip),%rdx
mov    $0xffff,%ecx
mov    $0x0,%al
call   1030 <draw_string@plt>
mov    -0x8(%rbp),%rdx
xor    %edi,%edi
mov    $0x30,%esi
mov    $0xffff,%ecx
mov    $0x0,%al
call   1030 <draw_string@plt>
jmp    1166 <error_bb+0x46>

x86 assembly (clang, -O2):
<error_bb>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <setup_video@plt>
lea    0xecc(%rip),%rdx
xor    %edi,%edi
mov    $0x18,%esi
mov    $0xffff,%ecx
xor    %eax,%eax
call   1030 <draw_string@plt>
xor    %edi,%edi
mov    $0x30,%esi
mov    %rbx,%rdx
mov    $0xffff,%ecx
xor    %eax,%eax
call   1030 <draw_string@plt>
nopl   (%rax)
jmp    1160 <error_bb+0x40>

LLVM IR (-O0):
@.str = [16 x i8] c"dcload-ip 1.0.3\00"
define void @error_bb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @setup_video(i32 0, i32 0)
%4 = call i32 (i32, i32, ...) @draw_string(i32 0, i32 24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 65535)
%5 = load i8*, i8** %2
%6 = call i32 (i32, i32, ...) @draw_string(i32 0, i32 48, i8* %5, i32 65535)
br label %7
7: ; preds = %1, %7
br label %7
}

LLVM IR (-O2):
@.str = [16 x i8] c"dcload-ip 1.0.3\00"
define void @error_bb(i8* %0) {
%2 = tail call i32 @setup_video(i32 0, i32 0)
%3 = tail call i32 (i32, i32, ...) @draw_string(i32 0, i32 24, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 65535)
%4 = tail call i32 (i32, i32, ...) @draw_string(i32 0, i32 48, i8* %0, i32 65535)
br label %5
5: ; preds = %1, %5
br label %5
}
/* Type definitions */
struct const_Intrusive_List {
  int dummy;
};
struct Intrusive_List {
  int dummy;
};

/* Variables and functions */
scalar_t__ constructor_empty_IL(int const, struct Intrusive_List *);
const struct const_Intrusive_List *
constructor_empty_const_IL(const int list_name,
                           const struct const_Intrusive_List *base) {
  return (const struct const_Intrusive_List *)constructor_empty_IL(
      list_name, (struct Intrusive_List *)base);
}


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

x86 assembly (clang, -O2):
<constructor_empty_const_IL>:
jmp    1030 <constructor_empty_IL@plt>

LLVM IR (-O0):
%struct.const_Intrusive_List = type { i32 }
%struct.Intrusive_List = type { i32 }
define %struct.const_Intrusive_List* @constructor_empty_const_IL(i32 %0, %struct.const_Intrusive_List* %1) {
%3 = alloca i32
%4 = alloca %struct.const_Intrusive_List*
store i32 %0, i32* %3
store %struct.const_Intrusive_List* %1, %struct.const_Intrusive_List** %4
%5 = load i32, i32* %3
%6 = load %struct.const_Intrusive_List*, %struct.const_Intrusive_List** %4
%7 = bitcast %struct.const_Intrusive_List* %6 to %struct.Intrusive_List*
%8 = call i64 @constructor_empty_IL(i32 %5, %struct.Intrusive_List* %7)
%9 = inttoptr i64 %8 to %struct.const_Intrusive_List*
ret %struct.const_Intrusive_List* %9
}

LLVM IR (-O2):
%struct.const_Intrusive_List = type { i32 }
%struct.Intrusive_List = type { i32 }
define %struct.const_Intrusive_List* @constructor_empty_const_IL(i32 %0, %struct.const_Intrusive_List* %1) {
%3 = bitcast %struct.const_Intrusive_List* %1 to %struct.Intrusive_List*
%4 = tail call i64 @constructor_empty_IL(i32 %0, %struct.Intrusive_List* %3)
%5 = inttoptr i64 %4 to %struct.const_Intrusive_List*
ret %struct.const_Intrusive_List* %5
}
/* Variables and functions */
scalar_t__ check_flag(char *, int, char **);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ setup_parent_signals();
int /*<<< orphan*/ start_children(char *, int, char **);
void setup_parent(char *name, int argc, char *argv[]) {
  if (check_flag("help", argc, argv)) {
    print_usage();
  }
  setup_parent_signals();
  start_children(name, argc, argv);
}


x86 assembly (clang, -O0):
<setup_parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe9f(%rip),%rdi
call   1060 <check_flag@plt>
cmp    $0x0,%rax
je     1177 <setup_parent+0x37>
mov    $0x0,%al
call   1050 <print_usage@plt>
mov    $0x0,%al
call   1040 <setup_parent_signals@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <start_children@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_parent>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xead(%rip),%rdi
call   1060 <check_flag@plt>
test   %rax,%rax
je     1164 <setup_parent+0x24>
xor    %eax,%eax
call   1050 <print_usage@plt>
xor    %eax,%eax
call   1040 <setup_parent_signals@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <start_children@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
define void @setup_parent(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %5
%8 = load i8**, i8*** %6
%9 = call i64 @check_flag(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7, i8** %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 (...) @print_usage()
br label %13
13: ; preds = %11, %3
%14 = call i32 (...) @setup_parent_signals()
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = load i8**, i8*** %6
%18 = call i32 @start_children(i8* %15, i32 %16, i8** %17)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
define void @setup_parent(i8* %0, i32 %1, i8** %2) {
%4 = tail call i64 @check_flag(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1, i8** %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (...) @print_usage()
br label %8
8: ; preds = %6, %3
%9 = tail call i32 (...) @setup_parent_signals()
%10 = tail call i32 @start_children(i8* %0, i32 %1, i8** %2)
ret void
}
void assert1(void) {
  ((1 == 1) ? ((void)0)
            : (__assert(__func__,
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/DeidaraC/"
                        "assert/refs/heads/master/test/test_assert_success.c",
                        7, "1 == 1")));
}


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

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

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

LLVM IR (-O2):
define void @assert1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
void *thread2Work(void *p) {
  for (int i = 0; i < 1000; i++) {
    printf("Thread 2: %d\n", i + 1);
    fflush(stdout);
  }
  pthread_exit(NULL);
  return NULL;
}


x86 assembly (clang, -O0):
<thread2Work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    117e <thread2Work+0x4e>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <thread2Work+0x13>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread2Work>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xebf(%rip),%r14
mov    0x2e98(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    (%r15),%edi
call   1050 <fflush@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1150 <thread2Work+0x20>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Thread 2: %d\0A\00"
@stdout = global i32 0
define i8* @thread2Work(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
%17 = call i32 @pthread_exit(i32* null)
ret i8* null
}

LLVM IR (-O2):
@.str = [14 x i8] c"Thread 2: %d\0A\00"
@stdout = global i32 0
define noalias i8* @thread2Work(i8* nocapture readnone %0) {
br label %4
2: ; preds = %4
%3 = tail call i32 @pthread_exit(i32* null)
ret i8* null
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %6, %4 ]
%6 = add nuw nsw i32 %5, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @fflush(i32 %8)
%10 = icmp eq i32 %6, 1000
br i1 %10, label %2, label %4
}
_Bool f1(_Bool x) { return !!x; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i1 @f1(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
%6 = xor i1 %5, true
%7 = xor i1 %6, true
ret i1 %7
}

LLVM IR (-O2):
define zeroext i1 @f1(i1 returned zeroext %0) {
ret i1 %0
}
float fa_fast_sqrtf(float number) {
  long i;
  float x, y;
  const float f = 1.5F;
  x = number * 0.5F;
  y = number;
  i = *(long *)&y;
  i = 0x5f3759df - (i >> 1);
  y = *(float *)&i;
  y = y * (f - (x * y * y));
  y = y * (f - (x * y * y));
  return number * y;
}


x86 assembly (clang, -O0):
<fa_fast_sqrtf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xee6(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
sar    $0x1,%rcx
mov    $0x5f3759df,%eax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe7b(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe41(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @fa_fast_sqrtf(float %0) {
%2 = alloca float
%3 = alloca i64
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %2
store float 1.500000e+00, float* %6
%7 = load float, float* %2
%8 = fmul float %7, 5.000000e-01
store float %8, float* %4
%9 = load float, float* %2
store float %9, float* %5
%10 = bitcast float* %5 to i64*
%11 = load i64, i64* %10
store i64 %11, i64* %3
%12 = load i64, i64* %3
%13 = ashr i64 %12, 1
%14 = sub nsw i64 1597463007, %13
store i64 %14, i64* %3
%15 = bitcast i64* %3 to float*
%16 = load float, float* %15
store float %16, float* %5
%17 = load float, float* %5
%18 = load float, float* %4
%19 = load float, float* %5
%20 = fmul float %18, %19
%21 = load float, float* %5
%22 = fneg float %20
%23 = call float @llvm.fmuladd.f32(float %22, float %21, float 1.500000e+00)
%24 = fmul float %17, %23
store float %24, float* %5
%25 = load float, float* %5
%26 = load float, float* %4
%27 = load float, float* %5
%28 = fmul float %26, %27
%29 = load float, float* %5
%30 = fneg float %28
%31 = call float @llvm.fmuladd.f32(float %30, float %29, float 1.500000e+00)
%32 = fmul float %25, %31
store float %32, float* %5
%33 = load float, float* %2
%34 = load float, float* %5
%35 = fmul float %33, %34
ret float %35
}

LLVM IR (-O2):
define float @fa_fast_sqrtf(float %0) {
ret float poison
}
/* Variables and functions */
int /*<<< orphan*/ primeFactorization();
int main(int argc, char const *argv[]) {
  primeFactorization();
  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    $0x0,%al
call   1030 <primeFactorization@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <primeFactorization@plt>
xor    %eax,%eax
pop    %rcx
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 = call i32 (...) @primeFactorization()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @primeFactorization()
ret i32 0
}
/* Variables and functions */
char toupper(char);
void wordCap(char *word) { *word = toupper(word[0]); }


x86 assembly (clang, -O0):
<wordCap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wordCap>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @wordCap(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = call signext i8 @toupper(i8 signext %5)
%7 = load i8*, i8** %2
store i8 %6, i8* %7
ret void
}

LLVM IR (-O2):
define void @wordCap(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call signext i8 @toupper(i8 signext %2)
store i8 %3, i8* %0
ret void
}
int right(int index) { return 2 * index + 2; }


x86 assembly (clang, -O0):
<right>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<right>:
lea    (%rdi,%rdi,1),%eax
add    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @right(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, 2
ret i32 %3
}
double dbl_test(double a, double b, double c, double d) {
  return (a > b) ? c : d;
}


x86 assembly (clang, -O0):
<dbl_test>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1137 <dbl_test+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1141 <dbl_test+0x41>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbl_test>:
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dbl_test(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = fcmp ogt double %9, %10
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load double, double* %7
br label %16
14: ; preds = %4
%15 = load double, double* %8
br label %16
16: ; preds = %14, %12
%17 = phi double [ %13, %12 ], [ %15, %14 ]
ret double %17
}

LLVM IR (-O2):
define double @dbl_test(double %0, double %1, double %2, double %3) {
%5 = fcmp ogt double %0, %1
%6 = select i1 %5, double %2, double %3
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ compileCondition2();
int /*<<< orphan*/ compileExpression();
void compileCondition(void) {
  compileExpression();
  compileCondition2();
}


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

x86 assembly (clang, -O2):
<compileCondition>:
push   %rax
xor    %eax,%eax
call   1030 <compileExpression@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <compileCondition2@plt>

LLVM IR (-O0):
define void @compileCondition() {
%1 = call i32 (...) @compileExpression()
%2 = call i32 (...) @compileCondition2()
ret void
}

LLVM IR (-O2):
define void @compileCondition() {
%1 = tail call i32 (...) @compileExpression()
%2 = tail call i32 (...) @compileCondition2()
ret void
}
char *ziperms(f)
char *f;
{ return ("----------"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"----------\00"
define i8* @ziperms(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [11 x i8] c"----------\00"
define i8* @ziperms(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double shoe, foot;
  shoe = 9.0;
  foot = 0.325 * shoe + 7.64;
  printf("Shoe size (men's) foot length\n");
  printf("%10.1f %15.2f inches\n", shoe, foot);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xeca(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rdi
movsd  0xec4(%rip),%xmm0
movsd  0xec4(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Shoe size (men's) foot length\0A\00"
@.str.1 = [22 x i8] c"%10.1f %15.2f inches\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 9.000000e+00, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double 3.250000e-01, double %4, double 0x401E8F5C28F5C28F)
store double %5, double* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = load double, double* %2
%8 = load double, double* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %7, double %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"%10.1f %15.2f inches\0A\00"
@str = [30 x i8] c"Shoe size (men's) foot length\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double 9.000000e+00, double 1.056500e+01)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ base_test();
int /*<<< orphan*/ greth_test(int);
int /*<<< orphan*/ i2cmst_test(int);
int /*<<< orphan*/ report_end();
int /*<<< orphan*/ report_start();
int /*<<< orphan*/ spictrl_test(int, int);
main() {
  report_start();
  base_test();
  greth_test(0x80000a00);
  i2cmst_test(0x80000800);
  spictrl_test(0x80000900, 2);
  report_end();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <report_start@plt>
mov    $0x0,%al
call   1070 <base_test@plt>
mov    $0x80000a00,%edi
call   1060 <greth_test@plt>
mov    $0x80000800,%edi
call   1030 <i2cmst_test@plt>
mov    $0x80000900,%edi
mov    $0x2,%esi
call   1040 <spictrl_test@plt>
mov    $0x0,%al
call   1050 <report_end@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <report_start@plt>
xor    %eax,%eax
call   1070 <base_test@plt>
mov    $0x80000a00,%edi
call   1060 <greth_test@plt>
mov    $0x80000800,%edi
call   1030 <i2cmst_test@plt>
mov    $0x80000900,%edi
mov    $0x2,%esi
call   1040 <spictrl_test@plt>
xor    %eax,%eax
call   1050 <report_end@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @report_start()
%2 = call i32 (...) @base_test()
%3 = call i32 @greth_test(i32 -2147481088)
%4 = call i32 @i2cmst_test(i32 -2147481600)
%5 = call i32 @spictrl_test(i32 -2147481344, i32 2)
%6 = call i32 (...) @report_end()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @report_start()
%2 = tail call i32 (...) @base_test()
%3 = tail call i32 @greth_test(i32 -2147481088)
%4 = tail call i32 @i2cmst_test(i32 -2147481600)
%5 = tail call i32 @spictrl_test(i32 -2147481344, i32 2)
%6 = tail call i32 (...) @report_end()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fpu_init();
int /*<<< orphan*/ process_bootinfo(void *);
void platform_init(void *arg) {
  process_bootinfo(arg);
  fpu_init();
}


x86 assembly (clang, -O0):
<platform_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <process_bootinfo@plt>
mov    $0x0,%al
call   1040 <fpu_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<platform_init>:
push   %rax
call   1030 <process_bootinfo@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <fpu_init@plt>

LLVM IR (-O0):
define void @platform_init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @process_bootinfo(i8* %3)
%5 = call i32 (...) @fpu_init()
ret void
}

LLVM IR (-O2):
define void @platform_init(i8* %0) {
%2 = tail call i32 @process_bootinfo(i8* %0)
%3 = tail call i32 (...) @fpu_init()
ret void
}
void WeaponFLASHBANG_Release(void) {}


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

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

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

LLVM IR (-O2):
define void @WeaponFLASHBANG_Release() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cleanup_func(void *arg) { printf("in cleanup_func\n"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"in cleanup_func\0A\00"
define void @cleanup_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"in cleanup_func\00"
define void @cleanup_func(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
void lbal_write(struct session *sp) {}


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

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

LLVM IR (-O0):
%struct.session = type opaque
define void @lbal_write(%struct.session* %0) {
%2 = alloca %struct.session*
store %struct.session* %0, %struct.session** %2
ret void
}

LLVM IR (-O2):
%struct.session = type opaque
define void @lbal_write(%struct.session* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ privlog();
int /*<<< orphan*/ setuid(int);
int main() {
  if (!setuid(1234)) {
    printf("setuid successfully!\n");
  } else {
    printf("setuid error!\n");
    perror("setuid\n");
  }
  privlog();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4d2,%edi
call   1060 <setuid@plt>
cmp    $0x0,%eax
jne    1173 <main+0x33>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    118b <main+0x4b>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1050 <privlog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4d2,%edi
call   1060 <setuid@plt>
test   %eax,%eax
jne    1166 <main+0x26>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <privlog@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe87(%rip),%rdi
call   1040 <perror@plt>
jmp    115b <main+0x1b>

LLVM IR (-O0):
@.str = [22 x i8] c"setuid successfully!\0A\00"
@.str.1 = [15 x i8] c"setuid error!\0A\00"
@.str.2 = [8 x i8] c"setuid\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 1234)
%3 = icmp ne i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %9
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %6, %4
%10 = call i32 (...) @privlog()
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [8 x i8] c"setuid\0A\00"
@str = [21 x i8] c"setuid successfully!\00"
@str.3 = [14 x i8] c"setuid error!\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 1234)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0))
%7 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %5, %3
%9 = tail call i32 (...) @privlog()
ret i32 0
}
unsigned short colour16(unsigned char r, unsigned char g, unsigned char b) {
  return ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3);
}


x86 assembly (clang, -O0):
<colour16>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
and    $0xf8,%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
and    $0xfc,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x3,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<colour16>:
and    $0xf8,%dl
movzbl %dl,%eax
shl    $0x8,%eax
and    $0xfffffffc,%esi
lea    (%rax,%rsi,8),%ecx
shr    $0x3,%dil
movzbl %dil,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @colour16(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = and i32 %8, 248
%10 = shl i32 %9, 8
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = and i32 %12, 252
%14 = shl i32 %13, 3
%15 = or i32 %10, %14
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = ashr i32 %17, 3
%19 = or i32 %15, %18
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @colour16(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = and i8 %2, -8
%5 = zext i8 %4 to i16
%6 = shl nuw i16 %5, 8
%7 = and i8 %1, -4
%8 = zext i8 %7 to i16
%9 = shl nuw nsw i16 %8, 3
%10 = or i16 %6, %9
%11 = lshr i8 %0, 3
%12 = zext i8 %11 to i16
%13 = or i16 %10, %12
ret i16 %13
}
unsigned int CollatzSequenceCount(unsigned int num) {
  unsigned int count = 1;
  while (num != 1) {
    if (num % 2 == 0) {
      num /= 2;
    } else {
      num = 3 * num + 1;
    }
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<CollatzSequenceCount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     114d <CollatzSequenceCount+0x4d>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1135 <CollatzSequenceCount+0x35>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <CollatzSequenceCount+0x3f>
imul   $0x3,-0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <CollatzSequenceCount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CollatzSequenceCount>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     1127 <CollatzSequenceCount+0x27>
mov    $0x1,%eax
nop
mov    %edi,%ecx
shr    %ecx
test   $0x1,%dil
lea    0x1(%rdi,%rdi,2),%edi
cmove  %ecx,%edi
add    $0x1,%eax
cmp    $0x1,%edi
jne    1110 <CollatzSequenceCount+0x10>
ret

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

LLVM IR (-O2):
define i32 @CollatzSequenceCount(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %12, %3 ], [ 1, %1 ]
%5 = phi i32 [ %11, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
%8 = lshr i32 %5, 1
%9 = mul i32 %5, 3
%10 = add i32 %9, 1
%11 = select i1 %7, i32 %8, i32 %10
%12 = add i32 %4, 1
%13 = icmp eq i32 %11, 1
br i1 %13, label %14, label %3
14: ; preds = %3, %1
%15 = phi i32 [ 1, %1 ], [ %12, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ __mriPlatform_CommSendChar(char);
void sendNAKToGDB(void) { __mriPlatform_CommSendChar('-'); }


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

x86 assembly (clang, -O2):
<sendNAKToGDB>:
mov    $0x2d,%edi
jmp    1030 <__mriPlatform_CommSendChar@plt>

LLVM IR (-O0):
define void @sendNAKToGDB() {
%1 = call i32 @__mriPlatform_CommSendChar(i8 signext 45)
ret void
}

LLVM IR (-O2):
define void @sendNAKToGDB() {
%1 = tail call i32 @__mriPlatform_CommSendChar(i8 signext 45)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *realloc(char *, scalar_t__);
char *strcat(char *, char *);
scalar_t__ strlen(char *);
char *strndup(char const *, size_t);
char *strnrecat(char *orig, const char *append, size_t n) {
  char *app = strndup(append, n);
  char *new = realloc(orig, strlen(orig) + n + 1);
  new = strcat(new, app);
  free(app);
  return new;
}


x86 assembly (clang, -O0):
<strnrecat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strndup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
add    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1060 <realloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnrecat>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1050 <strndup@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%rsi
add    $0x1,%rsi
mov    %r14,%rdi
call   1060 <realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strnrecat(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i8* @strndup(i8* %9, i64 %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %4
%13 = load i8*, i8** %4
%14 = call i64 @strlen(i8* %13)
%15 = load i64, i64* %6
%16 = add i64 %14, %15
%17 = add i64 %16, 1
%18 = call i8* @realloc(i8* %12, i64 %17)
store i8* %18, i8** %8
%19 = load i8*, i8** %8
%20 = load i8*, i8** %7
%21 = call i8* @strcat(i8* %19, i8* %20)
store i8* %21, i8** %8
%22 = load i8*, i8** %7
%23 = call i32 @free(i8* %22)
%24 = load i8*, i8** %8
ret i8* %24
}

LLVM IR (-O2):
define i8* @strnrecat(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i8* @strndup(i8* %1, i64 %2)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add i64 %2, 1
%7 = add i64 %6, %5
%8 = tail call i8* @realloc(i8* %0, i64 %7)
%9 = tail call i8* @strcat(i8* dereferenceable(1) %8, i8* dereferenceable(1) %4)
%10 = tail call i32 @free(i8* %4)
ret i8* %8
}
unsigned hash_str(const char *str) {
  unsigned h = 0;
  unsigned g;
  while (*str) {
    h <<= 4;
    h += *str;
    if ((g = h & 0xf0000000)) {
      h ^= (g >> 24);
      h ^= g;
    }
    str++;
  }
  return h;
}


x86 assembly (clang, -O0):
<hash_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     116c <hash_str+0x6c>
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xf0000000,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     115b <hash_str+0x5b>
mov    -0x10(%rbp),%eax
shr    $0x18,%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash_str+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_str>:
mov    (%rdi),%cl
test   %cl,%cl
je     113f <hash_str+0x3f>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x4,%eax
movsbl %cl,%ecx
add    %eax,%ecx
mov    %ecx,%edx
and    $0xf0000000,%edx
mov    %edx,%esi
shr    $0x18,%esi
mov    %ecx,%eax
and    $0xfffffff,%eax
xor    %esi,%eax
test   %edx,%edx
cmove  %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_str+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %18, %4 ], [ %2, %1 ]
%6 = phi i8* [ %17, %4 ], [ %0, %1 ]
%7 = phi i32 [ %16, %4 ], [ 0, %1 ]
%8 = shl i32 %7, 4
%9 = sext i8 %5 to i32
%10 = add i32 %8, %9
%11 = and i32 %10, -268435456
%12 = icmp eq i32 %11, 0
%13 = lshr exact i32 %11, 24
%14 = and i32 %10, 268435455
%15 = xor i32 %14, %13
%16 = select i1 %12, i32 %10, i32 %15
%17 = getelementptr inbounds i8, i8* %6, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %4
20: ; preds = %4, %1
%21 = phi i32 [ 0, %1 ], [ %16, %4 ]
ret i32 %21
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned int f17(unsigned int x, unsigned int y) {
  unsigned int r = x + y;
  if (r >= y)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f17>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jb     113a <f17+0x2a>
xor    %edi,%edi
call   1030 <foo@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f17>:
push   %rbx
mov    %edi,%ebx
add    %esi,%ebx
jb     111e <f17+0xe>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f17(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp uge i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @foo(i32 0)
br label %14
14: ; preds = %12, %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
define i32 @f17(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = icmp ult i32 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @foo(i32 0)
br label %7
7: ; preds = %5, %2
ret i32 %3
}