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

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  time_t current_time;
  time(&current_time);
  putenv("TZ=America/Los_Angeles");
  printf("%s", ctime(&current_time));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1060 <time@plt>
lea    0xea1(%rip),%rdi
call   1050 <putenv@plt>
lea    -0x14(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
lea    0xea7(%rip),%rdi
call   1050 <putenv@plt>
mov    %rbx,%rdi
call   1030 <ctime@plt>
lea    0xeaa(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"TZ=America/Los_Angeles\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 @time(i32* %5)
%7 = call i32 @putenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @ctime(i32* %5)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"TZ=America/Los_Angeles\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = call i32 @putenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i8* @ctime(i32* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}
int SDL_imageFilterShiftRightAndMultByByteMMX(unsigned char *Src1,
                                              unsigned char *Dest, int length,
                                              unsigned char N,
                                              unsigned char C) {
  return (0);
}


x86 assembly (clang, -O0):
<SDL_imageFilterShiftRightAndMultByByteMMX>:
push   %rbp
mov    %rsp,%rbp
mov    %r8b,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %cl,-0x15(%rbp)
mov    %al,-0x16(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SDL_imageFilterShiftRightAndMultByByteMMX(i8* %0, i8* %1, i32 %2, i8 zeroext %3, i8 zeroext %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8 %3, i8* %9
store i8 %4, i8* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @SDL_imageFilterShiftRightAndMultByByteMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i8 zeroext %3, i8 zeroext %4) {
ret i32 0
}
void free_ushort(unsigned short *val) {}


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

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

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

LLVM IR (-O2):
define void @free_ushort(i16* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _glp_lib_term_hook(int (*)(void *, char const *), void *);
void glp_term_hook(int (*func)(void *info, const char *s), void *info) {
  _glp_lib_term_hook(func, info);
  return;
}


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

x86 assembly (clang, -O2):
<glp_term_hook>:
jmp    1030 <_glp_lib_term_hook@plt>

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

LLVM IR (-O2):
define void @glp_term_hook(i32 (i8*, i8*)* %0, i8* %1) {
%3 = tail call i32 @_glp_lib_term_hook(i32 (i8*, i8*)* %0, i8* %1)
ret void
}
/* Variables and functions */
int starts_withn(char const *, char const *, size_t);
size_t strlen(char const *);
int starts_with(const char str[], const char prefix[]) {
  size_t prefix_len = strlen(prefix);
  return starts_withn(str, prefix, prefix_len);
}


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

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

LLVM IR (-O0):
define i32 @starts_with(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i32 @starts_withn(i8* %8, i8* %9, i64 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @starts_with(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i32 @starts_withn(i8* %0, i8* %1, i64 %3)
ret i32 %4
}
const char *f_name_in(long long int i) {
  switch (i) {
  case 0:
    return "i0";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<f_name_in>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
test   %rax,%rax
jne    112a <f_name_in+0x2a>
jmp    111a <f_name_in+0x1a>
lea    0xedf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1132 <f_name_in+0x32>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_name_in>:
xor    %eax,%eax
test   %rdi,%rdi
lea    0xef4(%rip),%rcx
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"i0\00"
define i8* @f_name_in(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
switch i64 %4, label %6 [
i64 0, label %5
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %7
6: ; preds = %1
store i8* null, i8** %2
br label %7
7: ; preds = %6, %5
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"i0\00"
define i8* @f_name_in(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* null
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(char *, int, size_t, int /*<<< orphan*/ *);
void mfile(size_t length, char ret[], FILE *fp, int *s) {
  size_t bytes = fread(ret, 1, length, fp);
  if (bytes != length) {
    *s = 0;
  }
}


x86 assembly (clang, -O0):
<mfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     115a <mfile+0x4a>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mfile>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rcx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1030 <fread@plt>
cmp    %rbx,%rax
je     1139 <mfile+0x29>
movl   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @mfile(i64 %0, i8* nocapture %1, i32* nocapture %2, i32* nocapture writeonly %3) {
%5 = tail call i64 @fread(i8* %1, i32 1, i64 %0, i32* %2)
%6 = icmp eq i64 %5, %0
br i1 %6, label %8, label %7
7: ; preds = %4
store i32 0, i32* %3
br label %8
8: ; preds = %7, %4
ret void
}
unsigned neg2wc(z, x, carry)
unsigned *z, x, carry;
{
  if (carry == 0) {
    *z = -x;
    return ((*z) != 0);
  } else {
    *z = -x - 1;
    return 1;
  }
}


x86 assembly (clang, -O0):
<neg2wc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    113a <neg2wc+0x3a>
xor    %ecx,%ecx
sub    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    114f <neg2wc+0x4f>
xor    %ecx,%ecx
sub    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<neg2wc>:
test   %edx,%edx
je     110e <neg2wc+0xe>
not    %esi
mov    %esi,(%rdi)
mov    $0x1,%eax
ret
xor    %eax,%eax
neg    %esi
setb   %al
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @neg2wc(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = sub i32 0, %1
store i32 %6, i32* %0
%7 = icmp ne i32 %1, 0
%8 = zext i1 %7 to i32
br label %11
9: ; preds = %3
%10 = xor i32 %1, -1
store i32 %10, i32* %0
br label %11
11: ; preds = %9, %5
%12 = phi i32 [ %8, %5 ], [ 1, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ E();
int /*<<< orphan*/ F();
void D() {
  E();
  F();
}


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

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

LLVM IR (-O0):
define void @D() {
%1 = call i32 (...) @E()
%2 = call i32 (...) @F()
ret void
}

LLVM IR (-O2):
define void @D() {
%1 = tail call i32 (...) @E()
%2 = tail call i32 (...) @F()
ret void
}
/* Type definitions */
struct REOContainer {
  int dummy;
};

/* Variables and functions */
struct REOContainer *REOFifo_peek_null(void *unused) {
  (void)unused;
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.REOContainer = type { i32 }
define %struct.REOContainer* @REOFifo_peek_null(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret %struct.REOContainer* null
}

LLVM IR (-O2):
%struct.REOContainer = type { i32 }
define noalias %struct.REOContainer* @REOFifo_peek_null(i8* nocapture readnone %0) {
ret %struct.REOContainer* null
}
char *bp_sw_type_to_error(int type) {
  switch (type) {
  case 1:
    return "Fatal Error";
  case 2:
    return "Warning Error";
  case 8:
    return "Information";
  default:
    return "Strange error type???";
  }
}


x86 assembly (clang, -O0):
<bp_sw_type_to_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     113d <bp_sw_type_to_error+0x3d>
jmp    111b <bp_sw_type_to_error+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     114d <bp_sw_type_to_error+0x4d>
jmp    112c <bp_sw_type_to_error+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     115d <bp_sw_type_to_error+0x5d>
jmp    116d <bp_sw_type_to_error+0x6d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <bp_sw_type_to_error+0x78>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <bp_sw_type_to_error+0x78>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <bp_sw_type_to_error+0x78>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bp_sw_type_to_error>:
cmp    $0x1,%edi
je     1117 <bp_sw_type_to_error+0x17>
cmp    $0x8,%edi
je     111f <bp_sw_type_to_error+0x1f>
cmp    $0x2,%edi
jne    1127 <bp_sw_type_to_error+0x27>
lea    0xef6(%rip),%rax
ret
lea    0xee2(%rip),%rax
ret
lea    0xef4(%rip),%rax
ret
lea    0xef8(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Fatal Error\00"
@.str.1 = [14 x i8] c"Warning Error\00"
@.str.2 = [12 x i8] c"Information\00"
@.str.3 = [22 x i8] c"Strange error type???\00"
define i8* @bp_sw_type_to_error(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 8, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [12 x i8] c"Fatal Error\00"
@.str.1 = [14 x i8] c"Warning Error\00"
@.str.2 = [12 x i8] c"Information\00"
@.str.3 = [22 x i8] c"Strange error type???\00"
define i8* @bp_sw_type_to_error(i32 %0) {
switch i32 %0, label %4 [
i32 1, label %5
i32 2, label %2
i32 8, label %3
]
2: ; preds = %1
br label %5
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3, %2
%6 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pxordemo();
int /*<<< orphan*/ pxorinit();
int main(void) {
  printf("%lu\n", pxorinit());
  printf("%lu\n", pxordemo());
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <pxorinit@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <pxordemo@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @pxorinit()
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 (...) @pxordemo()
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @pxorinit()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @pxordemo()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
struct psauxDevice {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeDevice(struct device *);
void psauxFreeDevice(struct psauxDevice *dev) {
  freeDevice((struct device *)dev);
}


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

x86 assembly (clang, -O2):
<psauxFreeDevice>:
jmp    1030 <freeDevice@plt>

LLVM IR (-O0):
%struct.psauxDevice = type { i32 }
%struct.device = type { i32 }
define void @psauxFreeDevice(%struct.psauxDevice* %0) {
%2 = alloca %struct.psauxDevice*
store %struct.psauxDevice* %0, %struct.psauxDevice** %2
%3 = load %struct.psauxDevice*, %struct.psauxDevice** %2
%4 = bitcast %struct.psauxDevice* %3 to %struct.device*
%5 = call i32 @freeDevice(%struct.device* %4)
ret void
}

LLVM IR (-O2):
%struct.psauxDevice = type { i32 }
%struct.device = type { i32 }
define void @psauxFreeDevice(%struct.psauxDevice* %0) {
%2 = bitcast %struct.psauxDevice* %0 to %struct.device*
%3 = tail call i32 @freeDevice(%struct.device* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int);
void printer(const char *func, int data) {
  int i;
  for (i = 0; i < data; i++) {
    printf("my work %s prints %d\n", func, i);
  }
}


x86 assembly (clang, -O0):
<printer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1153 <printer+0x43>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printer+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printer>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1144 <printer+0x34>
mov    %esi,%ebx
mov    %rdi,%r14
xor    %ebp,%ebp
lea    0xed7(%rip),%r15
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <printer+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"my work %s prints %d\0A\00"
define void @printer(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
void test_101(unsigned short *x, unsigned int *y) { y[0] = x[1] >> 2; }


x86 assembly (clang, -O0):
<test_101>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x2(%rax),%ecx
sar    $0x2,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_101>:
movzwl 0x2(%rdi),%eax
shr    $0x2,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @test_101(i16* %0, i32* %1) {
%3 = alloca i16*
%4 = alloca i32*
store i16* %0, i16** %3
store i32* %1, i32** %4
%5 = load i16*, i16** %3
%6 = getelementptr inbounds i16, i16* %5, i64 1
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 2
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
ret void
}

LLVM IR (-O2):
define void @test_101(i16* nocapture %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i16, i16* %0, i64 1
%4 = load i16, i16* %3
%5 = lshr i16 %4, 2
%6 = zext i16 %5 to i32
store i32 %6, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void scamper_icmp4_close(int fd) {
  close(fd);
  return;
}


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

x86 assembly (clang, -O2):
<scamper_icmp4_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @scamper_icmp4_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int vtstrcspn(s1, s2)
char *s1, *s2;
{
  char *p;
  for (p = s1; *p && !strchr(s2, *p); p++)
    ;
  return p - s1;
}


x86 assembly (clang, -O0):
<vtstrcspn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1159 <vtstrcspn+0x49>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1169 <vtstrcspn+0x59>
jmp    117f <vtstrcspn+0x6f>
jmp    116e <vtstrcspn+0x5e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <vtstrcspn+0x18>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vtstrcspn>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rdi),%al
mov    %rdi,%rbx
test   %al,%al
je     114c <vtstrcspn+0x3c>
mov    %rsi,%r15
mov    %r14,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    114c <vtstrcspn+0x3c>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <vtstrcspn+0x20>
sub    %r14d,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @vtstrcspn(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %23, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i8* @strchr(i8* %13, i32 %16)
%18 = icmp ne i8* %17, null
%19 = xor i1 %18, true
br label %20
20: ; preds = %12, %7
%21 = phi i1 [ false, %7 ], [ %19, %12 ]
br i1 %21, label %22, label %26
22: ; preds = %20
br label %23
23: ; preds = %22
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %5
br label %7
26: ; preds = %20
%27 = load i8*, i8** %5
%28 = load i8*, i8** %3
%29 = ptrtoint i8* %27 to i64
%30 = ptrtoint i8* %28 to i64
%31 = sub i64 %29, %30
%32 = trunc i64 %31 to i32
ret i32 %32
}

LLVM IR (-O2):
define i32 @vtstrcspn(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %13, %11 ], [ %3, %2 ]
%7 = phi i8* [ %12, %11 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = tail call i8* @strchr(i8* dereferenceable(1) %1, i32 %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %11, %2
%16 = phi i8* [ %0, %2 ], [ %12, %11 ], [ %7, %5 ]
%17 = ptrtoint i8* %16 to i64
%18 = ptrtoint i8* %0 to i64
%19 = sub i64 %17, %18
%20 = trunc i64 %19 to i32
ret i32 %20
}
int str_index(const char *str, const char *substr) { return -2; }


x86 assembly (clang, -O0):
<str_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xfffffffe,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @str_index(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -2
}
float add(float left, float right) { return left + right; }


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

x86 assembly (clang, -O2):
<add>:
addss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @add(float %0, float %1) {
%3 = fadd float %0, %1
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ parse_body_author(unsigned char const *);
__attribute__((visibility("hidden"))) void
tux_hw_parse_body_author(const unsigned char *frame) {
  parse_body_author(frame);
}


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

x86 assembly (clang, -O2):
<tux_hw_parse_body_author>:
jmp    1030 <parse_body_author@plt>

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

LLVM IR (-O2):
define hidden void @tux_hw_parse_body_author(i8* %0) {
%2 = tail call i32 @parse_body_author(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
int /*<<< orphan*/ inet_aton(char const *, struct in_addr *);
uint32_t strtoip(const char *ipstr) {
  struct in_addr in;
  inet_aton(ipstr, &in);
  return in.s_addr;
}


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

x86 assembly (clang, -O2):
<strtoip>:
push   %rax
mov    %rsp,%rsi
call   1030 <inet_aton@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
define i32 @strtoip(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.in_addr
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @inet_aton(i8* %4, %struct.in_addr* %3)
%6 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
define i32 @strtoip(i8* %0) {
%2 = alloca %struct.in_addr
%3 = bitcast %struct.in_addr* %2 to i8*
%4 = call i32 @inet_aton(i8* %0, %struct.in_addr* %2)
%5 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
imm0adr1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if (22 <= (*((short *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0adr1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0xa98ac7,%eax
movswl (%rax),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     1140 <imm0adr1+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <imm0adr1+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0adr1>:
xor    %eax,%eax
cmpw   $0x16,0xa98ac7
setge  %al
ret

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

LLVM IR (-O2):
define i32 @imm0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
%7 = load i16, i16* inttoptr (i64 11111111 to i16*)
%8 = icmp sgt i16 %7, 21
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0xd3() {
  Assert_real((isupper(211) == 0),
              "/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",
              1060, ("isupper should be 0 for 0xd3"));
}


x86 assembly (clang, -O0):
<t_isupper_0xd3>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd3,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x424,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0xd3>:
push   %rax
mov    $0xd3,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x424,%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 = [29 x i8] c"isupper should be 0 for 0xd3\00"
define void @t_isupper_0xd3() {
%1 = call i64 @isupper(i32 211)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1060, i8* getelementptr inbounds ([29 x i8], [29 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 = [29 x i8] c"isupper should be 0 for 0xd3\00"
define void @t_isupper_0xd3() {
%1 = tail call i64 @isupper(i32 211)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1060, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hej(void) { printf("hej! z podsamiuśkich Tater\n"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"hej! z podsamiu\C5\9Bkich Tater\0A\00"
define void @hej() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"hej! z podsamiu\C5\9Bkich Tater\00"
define void @hej() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  unsigned char i = 1;
  for (int numero = 3; i <= 5; numero += 5) {
    printf("%d\n", numero);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x1,-0x5(%rbp)
movl   $0x3,-0xc(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x5,%eax
jg     115c <main+0x4c>
mov    -0xc(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <main+0x1a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 13)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 18)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 23)
ret i32 0
}
/* Variables and functions */
scalar_t__ dbsvproto_cli_pcallback(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void processDBProtocol(int _c, char *_data, int _len) {
  int protocolID;
  if (dbsvproto_cli_pcallback(_c, _data, _len) < 0) {
    char string[256];
    sprintf(
        string,
        "[[PROTOCOL]]dbsvproto_cli_callback called failed.protocolID = %d\n",
        protocolID);
    return;
  }
  return;
}


x86 assembly (clang, -O0):
<processDBProtocol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <dbsvproto_cli_pcallback@plt>
cmp    $0x0,%rax
jge    1169 <processDBProtocol+0x49>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xea1(%rip),%rsi
call   1040 <sprintf@plt>
jmp    116e <processDBProtocol+0x4e>
jmp    116e <processDBProtocol+0x4e>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processDBProtocol>:
sub    $0x108,%rsp
call   1030 <dbsvproto_cli_pcallback@plt>
test   %rax,%rax
js     1139 <processDBProtocol+0x19>
add    $0x108,%rsp
ret
lea    0xec0(%rip),%rsi
mov    %rsp,%rdi
call   1040 <sprintf@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [66 x i8] c"[[PROTOCOL]]dbsvproto_cli_callback called failed.protocolID = %d\0A\00"
define void @processDBProtocol(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i64 @dbsvproto_cli_pcallback(i32 %9, i8* %10, i32 %11)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%16 = load i32, i32* %7
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %19
18: ; preds = %3
br label %19
19: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"[[PROTOCOL]]dbsvproto_cli_callback called failed.protocolID = %d\0A\00"
define void @processDBProtocol(i32 %0, i8* %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = tail call i64 @dbsvproto_cli_pcallback(i32 %0, i8* %1, i32 %2)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%9 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 undef)
br label %10
10: ; preds = %3, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int *, int);
int main(int argc, char **argv) {
  int sourceVal = argc;
  int destVal;
  int *sourcePtr = &sourceVal;
  int *destPtr = &destVal;
  memcpy((int *)&destVal, (int *)&sourceVal, 1);
  memcpy((int *)destPtr, (int *)sourcePtr, 1);
  return destVal + *destPtr;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%eax
mov    -0x28(%rbp),%rcx
add    (%rcx),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,0x4(%rsp)
mov    %rsp,%rbx
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%eax
add    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 %0, i32* %3
%6 = bitcast i32* %4 to i8*
%7 = call i32 @memcpy(i32* %4, i32* %3, i32 1)
%8 = call i32 @memcpy(i32* %4, i32* %3, i32 1)
%9 = load i32, i32* %4
%10 = shl nsw i32 %9, 1
ret i32 %10
}
int func_in_obj() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @func_in_obj() {
ret i32 0
}
/* Type definitions */
struct em8051 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
int disasm_cpl_c(struct em8051 *aCPU, int aPosition, char *aBuffer) {
  sprintf(aBuffer, "CPL   C");
  return 1;
}


x86 assembly (clang, -O0):
<disasm_cpl_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <sprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disasm_cpl_c>:
movabs $0x432020204c5043,%rax
mov    %rax,(%rdx)
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.em8051 = type { i32 }
@.str = [8 x i8] c"CPL C\00"
define i32 @disasm_cpl_c(%struct.em8051* %0, i32 %1, i8* %2) {
%4 = alloca %struct.em8051*
%5 = alloca i32
%6 = alloca i8*
store %struct.em8051* %0, %struct.em8051** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.em8051 = type { i32 }
define i32 @disasm_cpl_c(%struct.em8051* nocapture readnone %0, i32 %1, i8* nocapture writeonly %2) {
%4 = bitcast i8* %2 to i64*
store i64 18894145792528451, i64* %4
ret i32 1
}
void foo_1_1_1_1_2_1_2_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_1_1_2_1_2_2_1() {
ret void
}
/* Variables and functions */
int rand();
int roll(int n) {
  int r;
  do
    r = ((rand() % 32768) / 32767.0) * (n - 1) + 0.5;
  while (r >= n);
  return r;
}


x86 assembly (clang, -O0):
<roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x8000,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  0xed2(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    111b <roll+0xb>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    -0x1(%rbx),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <rand@plt>
lea    0x7fff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffff8000,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xea7(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0xea1(%rip),%xmm0
cvttsd2si %xmm0,%eax
cmp    %ebx,%eax
jge    1130 <roll+0x20>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %14, %1
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 32768
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, 3.276700e+04
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 1
%11 = sitofp i32 %10 to double
%12 = call double @llvm.fmuladd.f64(double %8, double %11, double 5.000000e-01)
%13 = fptosi double %12 to i32
store i32 %13, i32* %3
br label %14
14: ; preds = %4
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sge i32 %15, %16
br i1 %17, label %4, label %18
18: ; preds = %14
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @roll(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sitofp i32 %2 to double
br label %4
4: ; preds = %4, %1
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 32768
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, 3.276700e+04
%9 = tail call double @llvm.fmuladd.f64(double %8, double %3, double 5.000000e-01)
%10 = fptosi double %9 to i32
%11 = icmp slt i32 %10, %0
br i1 %11, label %12, label %4
12: ; preds = %4
ret i32 %10
}
void show_linux_prctl(void) {
  int rc;
  int arg2;
  char name[17] = {0};
}


x86 assembly (clang, -O0):
<show_linux_prctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1030 <memset@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @show_linux_prctl() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [17 x i8]
%4 = bitcast [17 x i8]* %3 to i8*
ret void
}

LLVM IR (-O2):
define void @show_linux_prctl() {
ret void
}
/* Variables and functions */
char *agstrcanon(char *, int /*<<< orphan*/);
int /*<<< orphan*/ getoutputbuffer(char *);
char *agcanonical(char *str) { return agstrcanon(str, getoutputbuffer(str)); }


x86 assembly (clang, -O0):
<agcanonical>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getoutputbuffer@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1030 <agstrcanon@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<agcanonical>:
push   %rbx
mov    %rdi,%rbx
call   1040 <getoutputbuffer@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <agstrcanon@plt>

LLVM IR (-O0):
define i8* @agcanonical(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @getoutputbuffer(i8* %4)
%6 = call i8* @agstrcanon(i8* %3, i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @agcanonical(i8* %0) {
%2 = tail call i32 @getoutputbuffer(i8* %0)
%3 = tail call i8* @agstrcanon(i8* %0, i32 %2)
ret i8* %3
}