xunge/DecIR huggingface dataset:
unsigned ceildiv(unsigned dividend, unsigned divisor) {
  return (dividend + 1) / divisor;
}


x86 assembly (clang, -O0):
<ceildiv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
xor    %edx,%edx
divl   -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceildiv>:
lea    0x1(%rdi),%eax
xor    %edx,%edx
div    %esi
ret

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

LLVM IR (-O2):
define i32 @ceildiv(i32 %0, i32 %1) {
%3 = add i32 %0, 1
%4 = udiv i32 %3, %1
ret i32 %4
}
void swap(int a, int b, int *l) {
  int tmp = l[a];
  l[a] = l[b];
  l[b] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %edi,%rax
mov    (%rdx,%rax,4),%ecx
movslq %esi,%rsi
mov    (%rdx,%rsi,4),%edi
mov    %edi,(%rdx,%rax,4)
mov    %ecx,(%rdx,%rsi,4)
ret

LLVM IR (-O0):
define void @swap(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %6
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %6
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %6
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32 %0, i32 %1, i32* nocapture %2) {
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds i32, i32* %2, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i32, i32* %2, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
unsigned long read_le32(unsigned char *in) {
  unsigned long result = 0;
  result |= (unsigned long)in[0];
  result |= (unsigned long)in[1] << 8;
  result |= (unsigned long)in[2] << 16;
  result |= (unsigned long)in[3] << 24;
  return result;
}


x86 assembly (clang, -O0):
<read_le32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x10,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @read_le32(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = load i64, i64* %3
%9 = or i64 %8, %7
store i64 %9, i64* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = shl i64 %13, 8
%15 = load i64, i64* %3
%16 = or i64 %15, %14
store i64 %16, i64* %3
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8, i8* %18
%20 = zext i8 %19 to i64
%21 = shl i64 %20, 16
%22 = load i64, i64* %3
%23 = or i64 %22, %21
store i64 %23, i64* %3
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 3
%26 = load i8, i8* %25
%27 = zext i8 %26 to i64
%28 = shl i64 %27, 24
%29 = load i64, i64* %3
%30 = or i64 %29, %28
store i64 %30, i64* %3
%31 = load i64, i64* %3
ret i64 %31
}

LLVM IR (-O2):
define i64 @read_le32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl nuw nsw i64 %6, 8
%8 = or i64 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = shl nuw nsw i64 %11, 16
%13 = or i64 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = shl nuw nsw i64 %16, 24
%18 = or i64 %13, %17
ret i64 %18
}
void foo463() {}


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

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

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

LLVM IR (-O2):
define void @foo463() {
ret void
}
/* Variables and functions */
int PHYSFS_unmount(char const *);
int PHYSFS_removeFromSearchPath(const char *oldDir) {
  return PHYSFS_unmount(oldDir);
}


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

x86 assembly (clang, -O2):
<PHYSFS_removeFromSearchPath>:
jmp    1030 <PHYSFS_unmount@plt>

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

LLVM IR (-O2):
define i32 @PHYSFS_removeFromSearchPath(i8* %0) {
%2 = tail call i32 @PHYSFS_unmount(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool isbcd(uint8_t i) {
  int h = i >> 4;
  int l = i & 0x0f;
  if ((h < 10) || (l < 10)) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<isbcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jl     112d <isbcd+0x2d>
cmpl   $0xa,-0x10(%rbp)
jge    1139 <isbcd+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1140 <isbcd+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isbcd>:
mov    %edi,%eax
and    $0xe,%eax
cmp    $0xa0,%edi
setl   %cl
cmp    $0xa,%eax
setb   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isbcd(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 4
store i32 %7, i32* %4
%8 = load i32, i32* %3
%9 = and i32 %8, 15
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 10
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %16
15: ; preds = %12, %1
store i32 1, i32* %2
br label %17
16: ; preds = %12
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @isbcd(i32 %0) {
%2 = and i32 %0, 14
%3 = icmp slt i32 %0, 160
%4 = icmp ult i32 %2, 10
%5 = or i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *curdate();
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
FILE *init_log(char *source) {
  char tname[40];
  sprintf(tname, "logs/%s-%s.log", tname, curdate());
  return fopen(tname, "w+");
}


x86 assembly (clang, -O0):
<init_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1050 <curdate@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xe9b(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x30(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <fopen@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_log>:
push   %rbx
sub    $0x30,%rsp
xor    %eax,%eax
call   1050 <curdate@plt>
lea    0xebd(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1040 <sprintf@plt>
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fopen@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"logs/%s-%s.log\00"
@.str.1 = [3 x i8] c"w+\00"
define i32* @init_log(i8* %0) {
%2 = alloca i8*
%3 = alloca [40 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%6 = call i8* (...) @curdate()
%7 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32* %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"logs/%s-%s.log\00"
@.str.1 = [3 x i8] c"w+\00"
define noalias i32* @init_log(i8* nocapture readnone %0) {
%2 = alloca [40 x i8]
%3 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%4 = tail call i8* (...) @curdate()
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%6 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32* %6
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_ld_dep_a(void) { op_write1(0x12); }


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

x86 assembly (clang, -O2):
<op_enc_ld_dep_a>:
mov    $0x12,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_ld_dep_a() {
%1 = call i32 @op_write1(i32 18)
ret void
}

LLVM IR (-O2):
define void @op_enc_ld_dep_a() {
%1 = tail call i32 @op_write1(i32 18)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dump_mem(void *, int, uintptr_t, int);
void dump_u32(void *buf, int len, uintptr_t addr) {
  dump_mem(buf, len, addr, 4);
}


x86 assembly (clang, -O0):
<dump_u32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <dump_mem@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_u32>:
mov    $0x4,%ecx
jmp    1030 <dump_mem@plt>

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

LLVM IR (-O2):
define void @dump_u32(i8* %0, i32 %1, i64 %2) {
%4 = tail call i32 @dump_mem(i8* %0, i32 %1, i64 %2, i32 4)
ret void
}
/* Variables and functions */
char *strchr(char const *, char);
const char *_XcursorNextPath(const char *path) {
  char *colon = strchr(path, ':');
  if (!colon)
    return NULL;
  return colon + 1;
}


x86 assembly (clang, -O0):
<_XcursorNextPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1146 <_XcursorNextPath+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1152 <_XcursorNextPath+0x42>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_XcursorNextPath>:
push   %rax
mov    $0x3a,%esi
call   1030 <strchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @_XcursorNextPath(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
/* Type definitions */
struct iarchive {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int ia_deserialize_int(struct iarchive *, char const *, int /*<<< orphan*/ *);
int ia_start_vector(struct iarchive *ia, const char *tag, int32_t *count) {
  return ia_deserialize_int(ia, tag, count);
}


x86 assembly (clang, -O0):
<ia_start_vector>:
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
mov    -0x18(%rbp),%rdx
call   1030 <ia_deserialize_int@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ia_start_vector>:
jmp    1030 <ia_deserialize_int@plt>

LLVM IR (-O0):
%struct.iarchive = type { i32 }
define i32 @ia_start_vector(%struct.iarchive* %0, i8* %1, i32* %2) {
%4 = alloca %struct.iarchive*
%5 = alloca i8*
%6 = alloca i32*
store %struct.iarchive* %0, %struct.iarchive** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load %struct.iarchive*, %struct.iarchive** %4
%8 = load i8*, i8** %5
%9 = load i32*, i32** %6
%10 = call i32 @ia_deserialize_int(%struct.iarchive* %7, i8* %8, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.iarchive = type { i32 }
define i32 @ia_start_vector(%struct.iarchive* %0, i8* %1, i32* %2) {
%4 = tail call i32 @ia_deserialize_int(%struct.iarchive* %0, i8* %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ enviarCadena_2(char *);
void enviarMensajeComp2(char *texto) { enviarCadena_2(texto); }


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

x86 assembly (clang, -O2):
<enviarMensajeComp2>:
jmp    1030 <enviarCadena_2@plt>

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

LLVM IR (-O2):
define void @enviarMensajeComp2(i8* %0) {
%2 = tail call i32 @enviarCadena_2(i8* %0)
ret void
}
int test_imm_3Dint16_mem(short *val) {
  return ((*val) & (0x3D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Dint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0x3d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_3Dint16_mem>:
testb  $0x3d,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Dint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 61
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_3Dint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 61
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ putn(int, int);
void put1(int t) { putn(1, t); }


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

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

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

LLVM IR (-O2):
define void @put1(i32 %0) {
%2 = tail call i32 @putn(i32 1, i32 %0)
ret void
}
void ceph_fscache_readpage_cancel(struct inode *inode, struct page *page) {}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.page = type opaque
define void @ceph_fscache_readpage_cancel(%struct.inode* %0, %struct.page* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.page*
store %struct.inode* %0, %struct.inode** %3
store %struct.page* %1, %struct.page** %4
ret void
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.page = type opaque
define void @ceph_fscache_readpage_cancel(%struct.inode* nocapture %0, %struct.page* nocapture %1) {
ret void
}
/* Variables and functions */
int printf(char *, int);
int f(int count) { return printf("hi %d\n", count); }


x86 assembly (clang, -O0):
<f>:
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):
<f>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"hi %d\0A\00"
define i32 @f(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 %2
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int ws_st_size(struct stat *ptr) { return ptr->st_size; }


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

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

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @ws_st_size(%struct.stat* %0) {
%2 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %2
%3 = load %struct.stat*, %struct.stat** %2
%4 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @ws_st_size(%struct.stat* nocapture %0) {
%2 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
void INT_Excep_SCI8_TEI8(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI8_TEI8() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __blast_assert();
void list_add(int *new) { ((new != NULL) ? (0) : __blast_assert()); }


x86 assembly (clang, -O0):
<list_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     112c <list_add+0x1c>
jmp    1133 <list_add+0x23>
mov    $0x0,%al
call   1030 <__blast_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_add>:
test   %rdi,%rdi
je     1116 <list_add+0x6>
ret
xor    %eax,%eax
jmp    1030 <__blast_assert@plt>

LLVM IR (-O0):
define void @list_add(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = call i32 (...) @__blast_assert()
br label %8
8: ; preds = %6, %5
%9 = phi i32 [ 0, %5 ], [ %7, %6 ]
ret void
}

LLVM IR (-O2):
define void @list_add(i32* readnone %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @__blast_assert()
br label %5
5: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ex6();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  printf("LISTA DE FDA 07\n");
  srand(time(NULL));
  ex6();
  getchar();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <ex6@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <ex6@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"LISTA DE FDA 07\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @ex6()
%6 = call i32 (...) @getchar()
%7 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"LISTA DE FDA 07\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 (...) @ex6()
%5 = tail call i32 (...) @getchar()
%6 = tail call i32 (...) @getchar()
ret i32 0
}
int num_active_dice(int *dice) {
  int i;
  for (i = 0; i < 6; i++) {
    if (dice[i] == -1) {
      return i;
    }
  }
  return 6;
}


x86 assembly (clang, -O0):
<num_active_dice>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    1149 <num_active_dice+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1136 <num_active_dice+0x36>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <num_active_dice+0x50>
jmp    113b <num_active_dice+0x3b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <num_active_dice+0xf>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_active_dice>:
cmpl   $0xffffffff,(%rdi)
je     112e <num_active_dice+0x2e>
cmpl   $0xffffffff,0x4(%rdi)
je     1131 <num_active_dice+0x31>
cmpl   $0xffffffff,0x8(%rdi)
je     1137 <num_active_dice+0x37>
cmpl   $0xffffffff,0xc(%rdi)
je     113d <num_active_dice+0x3d>
cmpl   $0xffffffff,0x10(%rdi)
je     1143 <num_active_dice+0x43>
xor    %ecx,%ecx
cmpl   $0xffffffff,0x14(%rdi)
sete   %cl
mov    $0x6,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret
mov    $0x1,%eax
ret
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret
mov    $0x4,%eax
ret

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

LLVM IR (-O2):
define i32 @num_active_dice(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, -1
br i1 %3, label %25, label %4
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, -1
br i1 %7, label %25, label %8
8: ; preds = %4
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, -1
br i1 %11, label %25, label %12
12: ; preds = %8
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, -1
br i1 %15, label %25, label %16
16: ; preds = %12
%17 = getelementptr inbounds i32, i32* %0, i64 4
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, -1
br i1 %19, label %25, label %20
20: ; preds = %16
%21 = getelementptr inbounds i32, i32* %0, i64 5
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, -1
%24 = select i1 %23, i32 5, i32 6
br label %25
25: ; preds = %20, %16, %12, %8, %4, %1
%26 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 2, %8 ], [ 3, %12 ], [ 4, %16 ], [ %24, %20 ]
ret i32 %26
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
uint16_t read_u16_from_buffer(const char *read) {
  uint16_t n_u16 = *((uint16_t *)read);
  return ntohs(n_u16);
}


x86 assembly (clang, -O0):
<read_u16_from_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ntohs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_u16_from_buffer>:
mov    (%rdi),%edi
jmp    1030 <ntohs@plt>

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

LLVM IR (-O2):
define i32 @read_u16_from_buffer(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @ntohs(i32 %3)
ret i32 %4
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void *cbmap_default_allocator(void *data, size_t data_len) {
  void *data_copy = malloc((data_len));
  if (data_copy == NULL) {
    return NULL;
  }
  memcpy(data_copy, data, data_len);
  return data_copy;
}


x86 assembly (clang, -O0):
<cbmap_default_allocator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1155 <cbmap_default_allocator+0x35>
movq   $0x0,-0x8(%rbp)
jmp    116e <cbmap_default_allocator+0x4e>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbmap_default_allocator>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1149 <cbmap_default_allocator+0x29>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @cbmap_default_allocator(i8* %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memcpy(i8* %3, i8* %0, i64 %1)
br label %7
7: ; preds = %2, %5
ret i8* %3
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int uint_size(uint64_t value) {
  int size = 1;
  uint64_t max_value = 1 << 8;
  for (max_value = 1 << 8; value >= max_value; max_value <<= 8) {
    size++;
    if (size == 8)
      break;
  }
  return size;
}


x86 assembly (clang, -O0):
<uint_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x100,-0xc(%rbp)
movl   $0x100,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1153 <uint_size+0x53>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jne    1140 <uint_size+0x40>
jmp    1153 <uint_size+0x53>
jmp    1145 <uint_size+0x45>
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
jmp    111c <uint_size+0x1c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint_size>:
mov    $0x1,%eax
cmp    $0x100,%edi
jl     112b <uint_size+0x2b>
mov    $0x2,%eax
cmp    $0x10000,%edi
jb     112b <uint_size+0x2b>
xor    %eax,%eax
cmp    $0x1000000,%edi
setae  %al
lea    (%rax,%rax,4),%eax
add    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @uint_size(i32 %0) {
%2 = icmp slt i32 %0, 256
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 65536
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 16777216
%7 = select i1 %6, i32 3, i32 8
br label %8
8: ; preds = %5, %3, %1
%9 = phi i32 [ 1, %1 ], [ 2, %3 ], [ %7, %5 ]
ret i32 %9
}
/* Variables and functions */
int mult(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int mult_and_print(int a, int b) {
  printf("%d * %d * = %d\n", a, b, mult(a, b));
}


x86 assembly (clang, -O0):
<mult_and_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <mult@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult_and_print>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <mult@plt>
lea    0xecd(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%d * %d * = %d\0A\00"
define i32 @mult_and_print(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @mult(i32 %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [16 x i8] c"%d * %d * = %d\0A\00"
define i32 @mult_and_print(i32 %0, i32 %1) {
%3 = tail call i32 @mult(i32 %0, i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %3)
ret i32 undef
}
/* Variables and functions */
size_t stmax(size_t a, size_t b) { return (a > b ? a : b); }


x86 assembly (clang, -O0):
<stmax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1127 <stmax+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <stmax+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stmax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmova  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @stmax(i64 %0, i64 %1) {
%3 = icmp ugt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int main() {
  int (*f)(int) = get_callback();
  return f(5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <get_callback@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    $0x5,%edi
call   *-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <get_callback@plt>
cltq
mov    $0x5,%edi
pop    %rcx
jmp    *%rax

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32 (i32)*
store i32 0, i32* %1
%3 = call i32 (...) @get_callback()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32 (i32)*
store i32 (i32)* %5, i32 (i32)** %2
%6 = load i32 (i32)*, i32 (i32)** %2
%7 = call i32 %6(i32 5)
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @get_callback()
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i32 (i32)*
%4 = tail call i32 %3(i32 5)
ret i32 %4
}
/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ myfoo(int *);
void mallocEscapeFoo() {
  int *p = malloc(12);
  myfoo(p);
  return;
}


x86 assembly (clang, -O0):
<mallocEscapeFoo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <myfoo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mallocEscapeFoo>:
push   %rax
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <myfoo@plt>

LLVM IR (-O0):
define void @mallocEscapeFoo() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 12)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @myfoo(i32* %3)
ret void
}

LLVM IR (-O2):
define void @mallocEscapeFoo() {
%1 = tail call i32* @malloc(i32 12)
%2 = tail call i32 @myfoo(i32* %1)
ret void
}
int who_mode(int mode, int who) {
  int ret = 0;
  if (who & (1 << 2))
    ret |= mode;
  if (who & (1 << 1))
    ret |= mode << 3;
  if (who & (1 << 0))
    ret |= mode << 6;
  return ret;
}


x86 assembly (clang, -O0):
<who_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1129 <who_mode+0x29>
mov    -0x4(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1144 <who_mode+0x44>
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     115f <who_mode+0x5f>
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<who_mode>:
mov    %esi,%ecx
shl    $0x1d,%ecx
sar    $0x1f,%ecx
and    %edi,%ecx
mov    %esi,%edx
shl    $0x1e,%edx
sar    $0x1f,%edx
lea    0x0(,%rdi,8),%eax
and    %edx,%eax
or     %ecx,%eax
and    $0x1,%esi
neg    %esi
shl    $0x6,%edi
and    %esi,%edi
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @who_mode(i32 %0, i32 %1) {
%3 = and i32 %1, 4
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 0, i32 %0
%6 = and i32 %1, 2
%7 = icmp eq i32 %6, 0
%8 = shl i32 %0, 3
%9 = select i1 %7, i32 0, i32 %8
%10 = or i32 %5, %9
%11 = and i32 %1, 1
%12 = icmp eq i32 %11, 0
%13 = shl i32 %0, 6
%14 = select i1 %12, i32 0, i32 %13
%15 = or i32 %10, %14
ret i32 %15
}
void UI_add_info_string(void) {}


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

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

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

LLVM IR (-O2):
define void @UI_add_info_string() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_wifidirect_discovery_usage(void) {
  printf("\nUsage : wifidirect_discovery_request/response [CONFIG_FILE]\n");
  printf("CONFIG_FILE contains WIFIDIRECT service discovery payload.\n");
  return;
}


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

x86 assembly (clang, -O2):
<print_wifidirect_discovery_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf19(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [62 x i8] c"\0AUsage : wifidirect_discovery_request/response [CONFIG_FILE]\0A\00"
@.str.1 = [60 x i8] c"CONFIG_FILE contains WIFIDIRECT service discovery payload.\0A\00"
define void @print_wifidirect_discovery_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [61 x i8] c"\0AUsage : wifidirect_discovery_request/response [CONFIG_FILE]\00"
@str.2 = [59 x i8] c"CONFIG_FILE contains WIFIDIRECT service discovery payload.\00"
define void @print_wifidirect_discovery_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t _kill(int32_t pid, int32_t sig) { return -1; }


x86 assembly (clang, -O0):
<_kill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @_kill(i32 %0, i32 %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ m68040_fpu_op1();
int /*<<< orphan*/ m68ki_exception_1111();
void m68k_op_040fpu1_32(void) {
  if (0) {
    m68040_fpu_op1();
    return;
  }
  m68ki_exception_1111();
}


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

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

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

LLVM IR (-O2):
define void @m68k_op_040fpu1_32() {
%1 = tail call i32 (...) @m68ki_exception_1111()
ret void
}
double atan_rd(double x) { return 0; }


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

x86 assembly (clang, -O2):
<atan_rd>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @atan_rd(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @atan_rd(double %0) {
ret double 0.000000e+00
}
const char *ccnxPortalServerAbout_LongNotice(void) {
  return "Copyright (c) 2017 Cisco and/or its affiliates.\nLicensed under the "
         "Apache License, Version 2.0 (the \"License\");\nyou may not use this "
         "file except in compliance with the License.\nYou may obtain a copy "
         "of the License at:\n\n    "
         "http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by "
         "applicable law or agreed to in writing, software\ndistributed under "
         "the License is distributed on an \"AS IS\" BASIS,\nWITHOUT "
         "WARRANTIES OR CONDITIONS OF ANY KIND, either express or "
         "implied.\nSee the License for the specific language governing "
         "permissions and\nlimitations under the License.\n";
}


x86 assembly (clang, -O0):
<ccnxPortalServerAbout_LongNotice>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [574 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0ALicensed under the Apache License, Version 2.0 (the \22License\22);\0Ayou may not use this file except in compliance with the License.\0AYou may obtain a copy of the License at:\0A\0A http://www.apache.org/licenses/LICENSE-2.0\0A\0AUnless required by applicable law or agreed to in writing, software\0Adistributed under the License is distributed on an \22AS IS\22 BASIS,\0AWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\0ASee the License for the specific language governing permissions and\0Alimitations under the License.\0A\00"
define i8* @ccnxPortalServerAbout_LongNotice() {
ret i8* getelementptr inbounds ([574 x i8], [574 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [574 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0ALicensed under the Apache License, Version 2.0 (the \22License\22);\0Ayou may not use this file except in compliance with the License.\0AYou may obtain a copy of the License at:\0A\0A http://www.apache.org/licenses/LICENSE-2.0\0A\0AUnless required by applicable law or agreed to in writing, software\0Adistributed under the License is distributed on an \22AS IS\22 BASIS,\0AWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\0ASee the License for the specific language governing permissions and\0Alimitations under the License.\0A\00"
define i8* @ccnxPortalServerAbout_LongNotice() {
ret i8* getelementptr inbounds ([574 x i8], [574 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
void *a_thread_func(void *num) {
  printf("arg = %li\n", (long)num);
  return num;
}


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

x86 assembly (clang, -O2):
<a_thread_func>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"arg = %li\0A\00"
define i8* @a_thread_func(i8* returned %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i8* %0
}
int int_compare(const void *v1, const void *v2) {
  const int *s1 = (const int *)v1;
  const int *s2 = (const int *)v2;
  return (*s2 - *s1);
}


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

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

LLVM IR (-O0):
define i32 @int_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @int_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ emit(char const *, char *, int, int);
void emit_inet6(const char *name, int level, int optname) {
  emit(name, "StandardProtocolFamily.INET6", level, optname);
}


x86 assembly (clang, -O0):
<emit_inet6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rsi
call   1030 <emit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_inet6>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <emit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"StandardProtocolFamily.INET6\00"
define void @emit_inet6(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @emit(i8* %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"StandardProtocolFamily.INET6\00"
define void @emit_inet6(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @emit(i8* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
/* Type definitions */
struct pagetable {
  int dummy;
};

/* Variables and functions */
struct pagetable *page_alloc(int);
struct pagetable *pagetable_create() {
  return page_alloc(1);
}


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

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

LLVM IR (-O0):
%struct.pagetable = type { i32 }
define %struct.pagetable* @pagetable_create() {
%1 = call %struct.pagetable* @page_alloc(i32 1)
ret %struct.pagetable* %1
}

LLVM IR (-O2):
%struct.pagetable = type { i32 }
define %struct.pagetable* @pagetable_create() {
%1 = tail call %struct.pagetable* @page_alloc(i32 1)
ret %struct.pagetable* %1
}