xunge/DecIR huggingface dataset:
unsigned long buf16_to_ulong(const void *buffer) {
  const unsigned char *p = buffer;
  return (((unsigned long)p[0] << 8) | p[1]);
}


x86 assembly (clang, -O0):
<buf16_to_ulong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%rax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buf16_to_ulong>:
movzwl (%rdi),%eax
shl    $0x30,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @buf16_to_ulong(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i64
%9 = shl i64 %8, 8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = or i64 %9, %13
ret i64 %14
}

LLVM IR (-O2):
define i64 @buf16_to_ulong(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = shl nuw nsw i64 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = or i64 %4, %7
ret i64 %8
}
void risest(unsigned char rw, unsigned char cl) {}


x86 assembly (clang, -O0):
<risest>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @risest(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
ret void
}

LLVM IR (-O2):
define void @risest(i8 zeroext %0, i8 zeroext %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CALC_appendString(char *);
void CALC_add3() { CALC_appendString("3"); }


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"3\00"
define void @CALC_add3() {
%1 = call i32 @CALC_appendString(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"3\00"
define void @CALC_add3() {
%1 = tail call i32 @CALC_appendString(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
void test_c(void) {}


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

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

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

LLVM IR (-O2):
define void @test_c() {
ret void
}
/* Variables and functions */
unsigned char genchecksum(void *, int);
int /*<<< orphan*/ read(int, unsigned char *, int);
int readframe(int fd, int framelength, void *frame) {
  unsigned char checksum[1];
  read(fd, frame, framelength);
  read(fd, checksum, 1);
  if (genchecksum(frame, framelength) == checksum[0])
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<readframe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <read@plt>
mov    -0x8(%rbp),%edi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <genchecksum@plt>
movzbl %al,%eax
movzbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jne    1179 <readframe+0x59>
movl   $0x0,-0x4(%rbp)
jmp    1180 <readframe+0x60>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readframe>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
mov    %rdx,%rsi
mov    %ebp,%edx
call   1040 <read@plt>
lea    0xf(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <genchecksum@plt>
xor    %ecx,%ecx
cmp    0xf(%rsp),%al
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @readframe(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [1 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%9 = load i32, i32* %5
%10 = load i8*, i8** %7
%11 = load i32, i32* %6
%12 = call i32 @read(i32 %9, i8* %10, i32 %11)
%13 = load i32, i32* %5
%14 = getelementptr inbounds [1 x i8], [1 x i8]* %8, i64 0, i64 0
%15 = call i32 @read(i32 %13, i8* %14, i32 1)
%16 = load i8*, i8** %7
%17 = load i32, i32* %6
%18 = call zeroext i8 @genchecksum(i8* %16, i32 %17)
%19 = zext i8 %18 to i32
%20 = getelementptr inbounds [1 x i8], [1 x i8]* %8, i64 0, i64 0
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = icmp eq i32 %19, %22
br i1 %23, label %24, label %25
24: ; preds = %3
store i32 0, i32* %4
br label %26
25: ; preds = %3
store i32 1, i32* %4
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @readframe(i32 %0, i32 %1, i8* %2) {
%4 = alloca [1 x i8]
%5 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @read(i32 %0, i8* %2, i32 %1)
%7 = call i32 @read(i32 %0, i8* %5, i32 1)
%8 = tail call zeroext i8 @genchecksum(i8* %2, i32 %1)
%9 = load i8, i8* %5
%10 = icmp ne i8 %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
int main() {
  char str[] = {"this is a dog"};
  char *start = str;
  int size = sizeof(str) / sizeof(char);
  rev_word(str);
  printf("%s\n", start);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0x12(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0xe,-0x24(%rbp)
lea    -0x12(%rbp),%rdi
mov    $0x0,%al
call   1040 <rev_word@plt>
mov    -0x20(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x676f6420612073,%rax
mov    %rax,0x6(%rsp)
movabs $0x2073692073696874,%rax
69 73 20
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <rev_word@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [14 x i8] c"this is a dog\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [14 x i8]* %2 to i8*
%6 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
store i8* %6, i8** %3
store i32 14, i32* %4
%7 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @rev_word to i32 (i8*, ...)*)(i8* %7)
%9 = load i8*, i8** %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [14 x i8] c"this is a dog\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @rev_word to i32 (i8*, ...)*)(i8* %2)
%4 = call i32 @puts(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ float_to_int16_timing_test(int);
int /*<<< orphan*/ printf(char *);
void output_conversion_timing_test(int count) {
  printf("*********************************************************************"
         "\n");
  printf("Output conversion Timing Test\n");
  float_to_int16_timing_test(count);
}


x86 assembly (clang, -O0):
<output_conversion_timing_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
lea    0xf09(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <float_to_int16_timing_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_conversion_timing_test>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xf10(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <float_to_int16_timing_test@plt>

LLVM IR (-O0):
@.str = [71 x i8] c"*********************************************************************\0A\00"
@.str.1 = [31 x i8] c"Output conversion Timing Test\0A\00"
define void @output_conversion_timing_test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @float_to_int16_timing_test(i32 %5)
ret void
}

LLVM IR (-O2):
@str = [70 x i8] c"*********************************************************************\00"
@str.2 = [30 x i8] c"Output conversion Timing Test\00"
define void @output_conversion_timing_test(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @float_to_int16_timing_test(i32 %0)
ret void
}
float Linear__easeOut(float t, float b, float c, float d, float p0, float p1) {
  return c * t / d + b;
}


x86 assembly (clang, -O0):
<Linear__easeOut>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Linear__easeOut>:
mulss  %xmm2,%xmm0
divss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @Linear__easeOut(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%13 = load float, float* %9
%14 = load float, float* %7
%15 = fmul float %13, %14
%16 = load float, float* %10
%17 = fdiv float %15, %16
%18 = load float, float* %8
%19 = fadd float %17, %18
ret float %19
}

LLVM IR (-O2):
define float @Linear__easeOut(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fmul float %0, %2
%8 = fdiv float %7, %3
%9 = fadd float %8, %1
ret float %9
}
void x_snoop_deinit(struct hostapd_data *hapd) {}


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

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

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

LLVM IR (-O2):
%struct.hostapd_data = type opaque
define void @x_snoop_deinit(%struct.hostapd_data* nocapture %0) {
ret void
}
int do_958() { return 958; }


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

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

LLVM IR (-O0):
define i32 @do_958() {
ret i32 958
}

LLVM IR (-O2):
define i32 @do_958() {
ret i32 958
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void foo(char *c) { printf("fooooo %c\n", *c); }


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

x86 assembly (clang, -O2):
<foo>:
movsbl (%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"fooooo %c\0A\00"
define void @foo(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  assert(2 <= 3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
void test() {
  int zero = 0;
  int x = (1 + (zero + 3));
  x = (2 + 3) * 2;
  x = 2 + 3 * 2;
  x = (0x10 | 0x20);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x8,-0x8(%rbp)
movl   $0x30,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 3
%5 = add nsw i32 1, %4
store i32 %5, i32* %2
store i32 10, i32* %2
store i32 8, i32* %2
store i32 48, i32* %2
ret void
}

LLVM IR (-O2):
define void @test() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ is_unique(char *);
int main() {
  char string1[] = "daniel";
  char string2[] = "dannel";
  is_unique(string1);
  is_unique(string2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x12(%rbp)
mov    0xebf(%rip),%ax
mov    %ax,-0xe(%rbp)
mov    0xeb7(%rip),%al
mov    %al,-0xc(%rbp)
lea    -0xb(%rbp),%rdi
call   1030 <is_unique@plt>
lea    -0x12(%rbp),%rdi
call   1030 <is_unique@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x6c6569,0x13(%rsp)
movl   $0x696e6164,0x10(%rsp)
69
movl   $0x6c656e,0xb(%rsp)
movl   $0x6e6e6164,0x8(%rsp)
6e
lea    0x10(%rsp),%rdi
call   1030 <is_unique@plt>
lea    0x8(%rsp),%rdi
call   1030 <is_unique@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.string1 = [7 x i8] c"daniel\00"
@__const.main.string2 = [7 x i8] c"dannel\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [7 x i8]
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = bitcast [7 x i8]* %3 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%7 = call i32 @is_unique(i8* %6)
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%9 = call i32 @is_unique(i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string1 = [7 x i8] c"daniel\00"
@__const.main.string2 = [7 x i8] c"dannel\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = call i32 @is_unique(i8* %3)
%6 = call i32 @is_unique(i8* %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ mtx_t;

/* Variables and functions */
#define EBUSY 128
int pthread_mutex_trylock(int /*<<< orphan*/ *);
int thrd_busy;
int thrd_error;
int thrd_success;
int mtx_trylock(mtx_t *mtx) {
  switch (pthread_mutex_trylock(mtx)) {
  case 0:
    return thrd_success;
  case EBUSY:
    return thrd_busy;
  default:
    return thrd_error;
  }
}


x86 assembly (clang, -O0):
<mtx_trylock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <pthread_mutex_trylock@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
test   %eax,%eax
je     114a <mtx_trylock+0x3a>
jmp    1137 <mtx_trylock+0x27>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     115b <mtx_trylock+0x4b>
jmp    116c <mtx_trylock+0x5c>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <mtx_trylock+0x68>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <mtx_trylock+0x68>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtx_trylock>:
push   %rax
call   1030 <pthread_mutex_trylock@plt>
cmp    $0x80,%eax
jne    112a <mtx_trylock+0x1a>
mov    0x2eac(%rip),%rcx
test   %eax,%eax
je     1135 <mtx_trylock+0x25>
jmp    113c <mtx_trylock+0x2c>
mov    0x2ea7(%rip),%rcx
test   %eax,%eax
jne    113c <mtx_trylock+0x2c>
mov    0x2eac(%rip),%rcx
mov    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
@thrd_success = global i32 0
@thrd_busy = global i32 0
@thrd_error = global i32 0
define i32 @mtx_trylock(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i32 @pthread_mutex_trylock(i32* %4)
switch i32 %5, label %10 [
i32 0, label %6
i32 128, label %8
]
6: ; preds = %1
%7 = load i32, i32* @thrd_success
store i32 %7, i32* %2
br label %12
8: ; preds = %1
%9 = load i32, i32* @thrd_busy
store i32 %9, i32* %2
br label %12
10: ; preds = %1
%11 = load i32, i32* @thrd_error
store i32 %11, i32* %2
br label %12
12: ; preds = %10, %8, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@thrd_success = global i32 0
@thrd_busy = global i32 0
@thrd_error = global i32 0
define i32 @mtx_trylock(i32* %0) {
%2 = tail call i32 @pthread_mutex_trylock(i32* %0)
%3 = icmp eq i32 %2, 128
%4 = icmp eq i32 %2, 0
%5 = load i32, i32* @thrd_success
%6 = load i32, i32* @thrd_busy
%7 = load i32, i32* @thrd_error
%8 = select i1 %3, i32 %6, i32 %7
%9 = select i1 %4, i32 %5, i32 %8
ret i32 %9
}
int uff_ask_invite(int idx) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @uff_ask_invite(i32 %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Arc172(long, long, long, long, double, double);
void arc(long x, long y, long rx, long ry, double sa, double ea) {
  Arc172(x, y, rx, ry, sa, ea);
}


x86 assembly (clang, -O0):
<arc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1030 <Arc172@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc>:
jmp    1030 <Arc172@plt>

LLVM IR (-O0):
define void @arc(i64 %0, i64 %1, i64 %2, i64 %3, double %4, double %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca double
%12 = alloca double
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store double %4, double* %11
store double %5, double* %12
%13 = load i64, i64* %7
%14 = load i64, i64* %8
%15 = load i64, i64* %9
%16 = load i64, i64* %10
%17 = load double, double* %11
%18 = load double, double* %12
%19 = call i32 @Arc172(i64 %13, i64 %14, i64 %15, i64 %16, double %17, double %18)
ret void
}

LLVM IR (-O2):
define void @arc(i64 %0, i64 %1, i64 %2, i64 %3, double %4, double %5) {
%7 = tail call i32 @Arc172(i64 %0, i64 %1, i64 %2, i64 %3, double %4, double %5)
ret void
}
/* Variables and functions */
char *strchr(char const *, int);
char *r_strchr(const char *s, int c) { return strchr(s, c); }


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

x86 assembly (clang, -O2):
<r_strchr>:
jmp    1030 <strchr@plt>

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

LLVM IR (-O2):
define i8* @r_strchr(i8* %0, i32 %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 %1)
ret i8* %3
}
void delay(unsigned int istep) {
  unsigned int i;
  for (i = 0; i < istep; i++) {
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    112d <delay+0x2d>
jmp    111f <delay+0x1f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <delay+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @delay(i32 %0) {
ret void
}
unsigned int tune7(unsigned int t) {
  return (t & t % 255) - (t * 3 & t >> 13 & t >> 6);
}


x86 assembly (clang, -O0):
<tune7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xff,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x8(%rbp),%eax
and    %edx,%eax
imul   $0x3,-0x4(%rbp),%ecx
mov    -0x4(%rbp),%edx
shr    $0xd,%edx
and    %edx,%ecx
mov    -0x4(%rbp),%edx
shr    $0x6,%edx
and    %edx,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tune7>:
mov    %edi,%ecx
mov    $0x80808081,%eax
imul   %rcx,%rax
shr    $0x27,%rax
mov    %eax,%ecx
shl    $0x8,%ecx
sub    %ecx,%eax
add    %edi,%eax
and    %edi,%eax
lea    (%rdi,%rdi,2),%ecx
mov    %edi,%edx
shr    $0xd,%edx
and    %ecx,%edx
shr    $0x6,%edi
and    %edx,%edi
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @tune7(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = urem i32 %4, 255
%6 = and i32 %3, %5
%7 = load i32, i32* %2
%8 = mul i32 %7, 3
%9 = load i32, i32* %2
%10 = lshr i32 %9, 13
%11 = and i32 %8, %10
%12 = load i32, i32* %2
%13 = lshr i32 %12, 6
%14 = and i32 %11, %13
%15 = sub i32 %6, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @tune7(i32 %0) {
%2 = urem i32 %0, 255
%3 = and i32 %2, %0
%4 = mul i32 %0, 3
%5 = lshr i32 %0, 13
%6 = and i32 %4, %5
%7 = lshr i32 %0, 6
%8 = and i32 %6, %7
%9 = sub nsw i32 %3, %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ newline();
int /*<<< orphan*/ printf(char *, char *);
void println(char str[20]) {
  printf("%s", str);
  newline();
}


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

x86 assembly (clang, -O2):
<println>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <newline@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @println(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @newline()
ret void
}
void av_md5_final() {}


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

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

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

LLVM IR (-O2):
define void @av_md5_final() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
void GetNameFromPath(char *lpOut, const char *szPath, const char *szName) {
  strcpy(lpOut, szPath);
  strcat(lpOut, szName);
}


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

x86 assembly (clang, -O2):
<GetNameFromPath>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcat@plt>

LLVM IR (-O0):
define void @GetNameFromPath(i8* %0, i8* %1, i8* %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** %4
%8 = load i8*, i8** %5
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = load i8*, i8** %4
%11 = load i8*, i8** %6
%12 = call i32 @strcat(i8* %10, i8* %11)
ret void
}

LLVM IR (-O2):
define void @GetNameFromPath(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcpy(i8* %0, i8* %1)
%5 = tail call i32 @strcat(i8* %0, i8* %2)
ret void
}
void foo336(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo336(i32 %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void sha1_unreverse(uint32_t *hash) {
  hash[4] = (hash[4] << 30) | (hash[4] >> 2);
  hash[4] += 0xC3D2E1F0;
}


x86 assembly (clang, -O0):
<sha1_unreverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
shl    $0x1e,%ecx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
sar    $0x2,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
add    $0xc3d2e1f0,%ecx
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha1_unreverse>:
mov    0x10(%rdi),%eax
mov    %eax,%ecx
shl    $0x1e,%ecx
sar    $0x2,%eax
or     %ecx,%eax
add    $0xc3d2e1f0,%eax
mov    %eax,0x10(%rdi)
ret

LLVM IR (-O0):
define void @sha1_unreverse(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 4
%5 = load i32, i32* %4
%6 = shl i32 %5, 30
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 4
%9 = load i32, i32* %8
%10 = ashr i32 %9, 2
%11 = or i32 %6, %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 4
store i32 %11, i32* %13
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 4
%16 = load i32, i32* %15
%17 = add i32 %16, -1009589776
store i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @sha1_unreverse(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = load i32, i32* %2
%4 = shl i32 %3, 30
%5 = ashr i32 %3, 2
%6 = or i32 %4, %5
%7 = add i32 %6, -1009589776
store i32 %7, i32* %2
ret void
}
short Maxlibs(x, y)
short x, y;
{
  short cnt = 4;
  if (x == 0 || x == 18)
    cnt--;
  if (y == 0 || y == 18)
    cnt--;
  return cnt;
}


x86 assembly (clang, -O0):
<Maxlibs>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%cx
mov    %si,%ax
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movw   $0x4,-0x6(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
je     1132 <Maxlibs+0x32>
movswl -0x2(%rbp),%eax
cmp    $0x12,%eax
jne    113e <Maxlibs+0x3e>
mov    -0x6(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x6(%rbp)
movswl -0x4(%rbp),%eax
cmp    $0x0,%eax
je     1158 <Maxlibs+0x58>
movswl -0x4(%rbp),%eax
cmp    $0x12,%eax
jne    1164 <Maxlibs+0x64>
mov    -0x6(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Maxlibs>:
shl    $0x10,%edi
cmp    $0x120000,%edi
sete   %al
test   %edi,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%ecx
mov    $0x4,%eax
sub    %ecx,%eax
shl    $0x10,%esi
cmp    $0x120000,%esi
je     112c <Maxlibs+0x2c>
test   %esi,%esi
jne    1132 <Maxlibs+0x32>
movzwl %ax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define signext i16 @Maxlibs(i32 %0, i32 %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
%6 = trunc i32 %0 to i16
%7 = trunc i32 %1 to i16
store i16 %6, i16* %3
store i16 %7, i16* %4
store i16 4, i16* %5
%8 = load i16, i16* %3
%9 = sext i16 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i16, i16* %3
%13 = sext i16 %12 to i32
%14 = icmp eq i32 %13, 18
br i1 %14, label %15, label %18
15: ; preds = %11, %2
%16 = load i16, i16* %5
%17 = add i16 %16, -1
store i16 %17, i16* %5
br label %18
18: ; preds = %15, %11
%19 = load i16, i16* %4
%20 = sext i16 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i16, i16* %4
%24 = sext i16 %23 to i32
%25 = icmp eq i32 %24, 18
br i1 %25, label %26, label %29
26: ; preds = %22, %18
%27 = load i16, i16* %5
%28 = add i16 %27, -1
store i16 %28, i16* %5
br label %29
29: ; preds = %26, %22
%30 = load i16, i16* %5
ret i16 %30
}

LLVM IR (-O2):
define signext i16 @Maxlibs(i32 %0, i32 %1) {
%3 = shl i32 %0, 16
%4 = icmp eq i32 %3, 1179648
%5 = icmp eq i32 %3, 0
%6 = or i1 %4, %5
%7 = select i1 %6, i16 3, i16 4
%8 = shl i32 %1, 16
switch i32 %8, label %11 [
i32 1179648, label %9
i32 0, label %9
]
9: ; preds = %2, %2
%10 = add nsw i16 %7, -1
br label %11
11: ; preds = %2, %9
%12 = phi i16 [ %10, %9 ], [ %7, %2 ]
ret i16 %12
}
void doStuff2(int g) {}


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

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

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

LLVM IR (-O2):
define void @doStuff2(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isupper(int);
void t_isupper_0x4e() {
  Assert_real((isupper(78)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isupper.c",
              395, ("isupper should be 1 for N"));
}


x86 assembly (clang, -O0):
<t_isupper_0x4e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4e,%edi
call   1030 <isupper@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x18b,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0x4e>:
push   %rax
mov    $0x4e,%edi
call   1030 <isupper@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x18b,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 1 for N\00"
define void @t_isupper_0x4e() {
%1 = call i32 @isupper(i32 78)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 395, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [26 x i8] c"isupper should be 1 for N\00"
define void @t_isupper_0x4e() {
%1 = tail call i32 @isupper(i32 78)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 395, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ MALLOC(int const);
int /*<<< orphan*/ filename_convert(char *, char const *, int const);
int strlen(char const *);
char *gen_local_filename(const char *filename) {
  const int l = strlen(filename);
  char *dst = (char *)MALLOC(l + 1);
  filename_convert(dst, filename, l);
  return dst;
}


x86 assembly (clang, -O0):
<gen_local_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <MALLOC@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <filename_convert@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_local_filename>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1050 <MALLOC@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <filename_convert@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @gen_local_filename(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @MALLOC(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @filename_convert(i8* %5, i8* %0, i32 %2)
ret i8* %5
}
int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
                          struct inode *new_dir, struct dentry *new_dentry) {
  return 0;
}


x86 assembly (clang, -O0):
<security_inode_rename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.dentry = type opaque
define i32 @security_inode_rename(%struct.inode* %0, %struct.dentry* %1, %struct.inode* %2, %struct.dentry* %3) {
%5 = alloca %struct.inode*
%6 = alloca %struct.dentry*
%7 = alloca %struct.inode*
%8 = alloca %struct.dentry*
store %struct.inode* %0, %struct.inode** %5
store %struct.dentry* %1, %struct.dentry** %6
store %struct.inode* %2, %struct.inode** %7
store %struct.dentry* %3, %struct.dentry** %8
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.dentry = type opaque
define i32 @security_inode_rename(%struct.inode* nocapture readnone %0, %struct.dentry* nocapture readnone %1, %struct.inode* nocapture readnone %2, %struct.dentry* nocapture readnone %3) {
ret i32 0
}
void UARTFIFOTrigLvlGranControl(unsigned int baseAdd,
                                unsigned int rxFIFOGranCtrl,
                                unsigned int txFIFOGranCtrl) {
  (*((volatile unsigned int *)(baseAdd + (0x40)))) &=
      ~((0x00000080u) | (0x00000040u));
  (*((volatile unsigned int *)(baseAdd + (0x40)))) |=
      (rxFIFOGranCtrl & (0x00000080u));
  (*((volatile unsigned int *)(baseAdd + (0x40)))) |=
      (txFIFOGranCtrl & (0x00000040u));
}


x86 assembly (clang, -O0):
<UARTFIFOTrigLvlGranControl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffffff3f,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
and    $0x80,%edx
mov    -0x4(%rbp),%eax
add    $0x40,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
and    $0x40,%edx
mov    -0x4(%rbp),%eax
add    $0x40,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFIFOTrigLvlGranControl>:
add    $0x40,%edi
andl   $0xffffff3f,(%rdi)
and    $0x80,%esi
or     %esi,(%rdi)
and    $0x40,%edx
or     %edx,(%rdi)
ret

LLVM IR (-O0):
define void @UARTFIFOTrigLvlGranControl(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = add i32 %7, 64
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = and i32 %11, -193
store volatile i32 %12, i32* %10
%13 = load i32, i32* %5
%14 = and i32 %13, 128
%15 = load i32, i32* %4
%16 = add i32 %15, 64
%17 = zext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = or i32 %19, %14
store volatile i32 %20, i32* %18
%21 = load i32, i32* %6
%22 = and i32 %21, 64
%23 = load i32, i32* %4
%24 = add i32 %23, 64
%25 = zext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
%27 = load volatile i32, i32* %26
%28 = or i32 %27, %22
store volatile i32 %28, i32* %26
ret void
}

LLVM IR (-O2):
define void @UARTFIFOTrigLvlGranControl(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %0, 64
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -193
store volatile i32 %8, i32* %6
%9 = and i32 %1, 128
%10 = load volatile i32, i32* %6
%11 = or i32 %10, %9
store volatile i32 %11, i32* %6
%12 = and i32 %2, 64
%13 = load volatile i32, i32* %6
%14 = or i32 %13, %12
store volatile i32 %14, i32* %6
ret void
}
char *num_arg_0(char *d, unsigned int arg, int n) {
  int i;
  for (i = 0; i < n; i++) {
    d[n - i - 1] = '0' + arg % 10;
    arg /= 10;
  }
  return d + n;
}


x86 assembly (clang, -O0):
<num_arg_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1160 <num_arg_0+0x60>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <num_arg_0+0x15>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_arg_0>:
mov    %rdi,%rax
test   %edx,%edx
jle    1135 <num_arg_0+0x35>
mov    %edx,%r9d
mov    $0xcccccccd,%r8d
mov    %esi,%edi
imul   %r8,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%esi
or     $0x30,%sil
add    $0xffffffffffffffff,%r9
movslq %r9d,%rcx
mov    %sil,(%rax,%rcx,1)
mov    %edi,%esi
jne    1110 <num_arg_0+0x10>
movslq %edx,%rcx
add    %rcx,%rax
ret

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

LLVM IR (-O2):
define i8* @num_arg_0(i8* writeonly %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %21
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %19, %7 ]
%9 = phi i32 [ %1, %5 ], [ %18, %7 ]
%10 = urem i32 %9, 10
%11 = trunc i32 %10 to i8
%12 = or i8 %11, 48
%13 = trunc i64 %8 to i32
%14 = xor i32 %13, -1
%15 = add i32 %14, %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %12, i8* %17
%18 = udiv i32 %9, 10
%19 = add nuw nsw i64 %8, 1
%20 = icmp eq i64 %19, %6
br i1 %20, label %21, label %7
21: ; preds = %7, %3
%22 = sext i32 %2 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
ret i8* %23
}
/* Variables and functions */
int reg(int);
int main(void) {
  int t = 1;
  return reg(t);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @reg(i32 1)
ret i32 %1
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int clock_gettime_syscall_wrapper(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *);
void clock_gettime_syscall_nofail(clockid_t id, struct timespec *ts) {
  int err;
  err = clock_gettime_syscall_wrapper(id, ts);
  if (err)
    error(EXIT_FAILURE, errno, "SYS_clock_gettime");
}


x86 assembly (clang, -O0):
<clock_gettime_syscall_nofail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <clock_gettime_syscall_wrapper@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1166 <clock_gettime_syscall_nofail+0x46>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
lea    0xe9f(%rip),%rdx
call   1030 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_gettime_syscall_nofail>:
push   %rax
call   1040 <clock_gettime_syscall_wrapper@plt>
test   %eax,%eax
je     1149 <clock_gettime_syscall_nofail+0x29>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdx
pop    %rax
jmp    1030 <error@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@EXIT_FAILURE = global i32 0
@errno = global i32 0
@.str = [18 x i8] c"SYS_clock_gettime\00"
define void @clock_gettime_syscall_nofail(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%6 = load i32, i32* %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i32 @clock_gettime_syscall_wrapper(i32 %6, %struct.timespec* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
%13 = load i32, i32* @errno
%14 = call i32 @error(i32 %12, i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@EXIT_FAILURE = global i32 0
@errno = global i32 0
@.str = [18 x i8] c"SYS_clock_gettime\00"
define void @clock_gettime_syscall_nofail(i32 %0, %struct.timespec* %1) {
%3 = tail call i32 @clock_gettime_syscall_wrapper(i32 %0, %struct.timespec* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @EXIT_FAILURE
%7 = load i32, i32* @errno
%8 = tail call i32 @error(i32 %6, i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %5, %2
ret void
}
void foo_1_2_1_1_2_1_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_1_2_1_2_2_2() {
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int FileExists(char *path) {
  struct stat file_stat;
  if (stat(path, &file_stat))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<FileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <FileExists+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1146 <FileExists+0x36>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FileExists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @FileExists(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %10
9: ; preds = %1
store i32 1, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @FileExists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int pipe(int *);
int bad_pipe(void *addr) { return pipe((int *)addr); }


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

x86 assembly (clang, -O2):
<bad_pipe>:
jmp    1030 <pipe@plt>

LLVM IR (-O0):
define i32 @bad_pipe(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @pipe(i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @bad_pipe(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @pipe(i32* %2)
ret i32 %3
}
int test_sisf(float x) { return (int)x; }


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

x86 assembly (clang, -O2):
<test_sisf>:
cvttss2si %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @test_sisf(float %0) {
%2 = fptosi float %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void signalCatcher(int signo) { printf("Caught an interrupt:  %d\n", signo); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Caught an interrupt: %d\0A\00"
define void @signalCatcher(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Caught an interrupt: %d\0A\00"
define void @signalCatcher(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}