xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cli_fatal(char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int open(char const *, int, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void cli_file_open(const char *fpath, int flags, int *fd) {
  if ((*fd = open(fpath, flags, 0644)) == -1)
    cli_fatal("cli_file_open(%s): %s", fpath, strerror(errno));
}


x86 assembly (clang, -O0):
<cli_file_open>:
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    $0x1a4,%edx
call   1040 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0xffffffff,%eax
jne    118b <cli_file_open+0x5b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
call   1030 <cli_fatal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_file_open>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
mov    $0x1a4,%edx
call   1040 <open@plt>
mov    %eax,(%rbx)
cmp    $0xffffffff,%eax
je     1153 <cli_file_open+0x23>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe98(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <cli_fatal@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"cli_file_open(%s): %s\00"
@errno = global i32 0
define void @cli_file_open(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 = call i32 @open(i8* %7, i32 %8, i32 420)
%10 = load i32*, i32** %6
store i32 %9, i32* %10
%11 = icmp eq i32 %9, -1
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = load i32, i32* @errno
%15 = call i32 @strerror(i32 %14)
%16 = call i32 @cli_fatal(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %15)
br label %17
17: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"cli_file_open(%s): %s\00"
@errno = global i32 0
define void @cli_file_open(i8* %0, i32 %1, i32* nocapture writeonly %2) {
%4 = tail call i32 @open(i8* %0, i32 %1, i32 420)
store i32 %4, i32* %2
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @cli_fatal(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %8)
br label %10
10: ; preds = %6, %3
ret void
}
/* Variables and functions */
int iTlvBatchAddField55ObjBase(unsigned char, unsigned char *, unsigned char *,
                               int, int, int /*<<< orphan*/);
int iTlvBatchAddField55Obj(unsigned char ucFlag, unsigned char *psTlvBuffer,
                           unsigned char *psField55, int iField55Len,
                           int iConflictFlag) {
  int iRet;
  iRet = iTlvBatchAddField55ObjBase(ucFlag, psTlvBuffer, psField55, iField55Len,
                                    iConflictFlag, 0);
  return (iRet);
}


x86 assembly (clang, -O0):
<iTlvBatchAddField55Obj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
xor    %r9d,%r9d
movzbl %al,%edi
call   1030 <iTlvBatchAddField55ObjBase@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iTlvBatchAddField55Obj>:
xor    %r9d,%r9d
jmp    1030 <iTlvBatchAddField55ObjBase@plt>

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

LLVM IR (-O2):
define i32 @iTlvBatchAddField55Obj(i8 zeroext %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @iTlvBatchAddField55ObjBase(i8 zeroext %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 0)
ret i32 %6
}
float evaluateDerivationAtParameterWithCoefficients(float t,
                                                    float coefficients[]) {
  return coefficients[1] + 2 * t * coefficients[2] +
         3 * t * t * coefficients[3];
}


x86 assembly (clang, -O0):
<evaluateDerivationAtParameterWithCoefficients>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  0xee6(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xec4(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluateDerivationAtParameterWithCoefficients>:
movaps %xmm0,%xmm1
addss  %xmm0,%xmm1
mulss  0x8(%rdi),%xmm1
addss  0x4(%rdi),%xmm1
movss  0xee7(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm2,%xmm0
mulss  0xc(%rdi),%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @evaluateDerivationAtParameterWithCoefficients(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
store float %0, float* %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = getelementptr inbounds float, float* %5, i64 1
%7 = load float, float* %6
%8 = load float, float* %3
%9 = fmul float 2.000000e+00, %8
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 2
%12 = load float, float* %11
%13 = call float @llvm.fmuladd.f32(float %9, float %12, float %7)
%14 = load float, float* %3
%15 = fmul float 3.000000e+00, %14
%16 = load float, float* %3
%17 = fmul float %15, %16
%18 = load float*, float** %4
%19 = getelementptr inbounds float, float* %18, i64 3
%20 = load float, float* %19
%21 = call float @llvm.fmuladd.f32(float %17, float %20, float %13)
ret float %21
}

LLVM IR (-O2):
define float @evaluateDerivationAtParameterWithCoefficients(float %0, float* nocapture %1) {
%3 = getelementptr inbounds float, float* %1, i64 1
%4 = load float, float* %3
%5 = fmul float %0, 2.000000e+00
%6 = getelementptr inbounds float, float* %1, i64 2
%7 = load float, float* %6
%8 = tail call float @llvm.fmuladd.f32(float %5, float %7, float %4)
%9 = fmul float %0, 3.000000e+00
%10 = fmul float %9, %0
%11 = getelementptr inbounds float, float* %1, i64 3
%12 = load float, float* %11
%13 = tail call float @llvm.fmuladd.f32(float %10, float %12, float %8)
ret float %13
}
/* Type definitions */
struct ptrlist_struct {
  int dummy;
};
struct elasticarray {
  int dummy;
};

/* Variables and functions */
int elasticarray_truncate(struct elasticarray *);
int ptrlist_truncate(struct ptrlist_struct *EA) {
  return (elasticarray_truncate((struct elasticarray *)EA));
}


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

x86 assembly (clang, -O2):
<ptrlist_truncate>:
jmp    1030 <elasticarray_truncate@plt>

LLVM IR (-O0):
%struct.ptrlist_struct = type { i32 }
%struct.elasticarray = type { i32 }
define i32 @ptrlist_truncate(%struct.ptrlist_struct* %0) {
%2 = alloca %struct.ptrlist_struct*
store %struct.ptrlist_struct* %0, %struct.ptrlist_struct** %2
%3 = load %struct.ptrlist_struct*, %struct.ptrlist_struct** %2
%4 = bitcast %struct.ptrlist_struct* %3 to %struct.elasticarray*
%5 = call i32 @elasticarray_truncate(%struct.elasticarray* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.ptrlist_struct = type { i32 }
%struct.elasticarray = type { i32 }
define i32 @ptrlist_truncate(%struct.ptrlist_struct* %0) {
%2 = bitcast %struct.ptrlist_struct* %0 to %struct.elasticarray*
%3 = tail call i32 @elasticarray_truncate(%struct.elasticarray* %2)
ret i32 %3
}
/* Variables and functions */
scalar_t__ util_rng_next(int);
bool util_rng_next_boolean() { return util_rng_next(1) != 0; }


x86 assembly (clang, -O0):
<util_rng_next_boolean>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <util_rng_next@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_rng_next_boolean>:
push   %rax
mov    $0x1,%edi
call   1030 <util_rng_next@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @util_rng_next_boolean() {
%1 = call i64 @util_rng_next(i32 1)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @util_rng_next_boolean() {
%1 = tail call i64 @util_rng_next(i32 1)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void OTG_HS_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @OTG_HS_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @OTG_HS_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
unsigned short _c2us(const char *c) {
  unsigned short *rtn = (unsigned short *)c;
  return *rtn;
}


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

x86 assembly (clang, -O2):
<_c2us>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i16 @_c2us(i8* %0) {
%2 = alloca i8*
%3 = alloca i16*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i16*
store i16* %5, i16** %3
%6 = load i16*, i16** %3
%7 = load i16, i16* %6
ret i16 %7
}

LLVM IR (-O2):
define zeroext i16 @_c2us(i8* nocapture %0) {
%2 = bitcast i8* %0 to i16*
%3 = load i16, i16* %2
ret i16 %3
}
/* Variables and functions */
scalar_t__ _syscall5(int, void *, void *, void *, void *, void *);
int /*<<< orphan*/ fflush(void *);
void exit(int status) {
  fflush(((void *)0));
  (int)_syscall5(9, (void *)status, ((void *)0), ((void *)0), ((void *)0),
                 ((void *)0));
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <fflush@plt>
movslq -0x4(%rbp),%rsi
mov    $0x9,%edi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
call   1040 <_syscall5@plt>

x86 assembly (clang, -O2):
<exit>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <fflush@plt>
movslq %ebx,%rsi
mov    $0x9,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <_syscall5@plt>

LLVM IR (-O0):
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @fflush(i8* null)
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = call i64 @_syscall5(i32 9, i8* %6, i8* null, i8* null, i8* null, i8* null)
%8 = trunc i64 %7 to i32
unreachable
}

LLVM IR (-O2):
define void @exit(i32 %0) {
%2 = tail call i32 @fflush(i8* null)
%3 = sext i32 %0 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @_syscall5(i32 9, i8* %4, i8* null, i8* null, i8* null, i8* null)
unreachable
}
/* Type definitions */
struct statfs {
  scalar_t__ f_type;
};

/* Variables and functions */
scalar_t__ statfs(char const *, struct statfs *);
int mounted(const char *path, long magic) {
  struct statfs st_fs;
  if (statfs(path, &st_fs) < 0)
    return -1;
  if ((long)st_fs.f_type != magic)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<mounted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <statfs@plt>
cmp    $0x0,%rax
jge    1143 <mounted+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    1164 <mounted+0x54>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     115d <mounted+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    1164 <mounted+0x54>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mounted>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <statfs@plt>
xor    %ecx,%ecx
cmp    %rbx,0x8(%rsp)
sete   %cl
test   %rax,%rax
mov    $0xffffffff,%eax
cmovns %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.statfs = type { i64 }
define i32 @mounted(i8* %0, i64 %1) {
%3 = alloca %struct.statfs
%4 = bitcast %struct.statfs* %3 to i8*
%5 = call i64 @statfs(i8* %0, %struct.statfs* %3)
%6 = icmp slt i64 %5, 0
%7 = getelementptr inbounds %struct.statfs, %struct.statfs* %3, i64 0, i32 0
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, %1
%10 = zext i1 %9 to i32
%11 = select i1 %6, i32 -1, i32 %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo(int);
int main() {
  foo(42);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2a,%edi
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2a,%edi
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 42)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 42)
%2 = tail call i32 @exit(i32 0)
unreachable
}
int main(int argc, char **argv, char **envp) {
  while (1) {
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
jmp    1116 <main+0x16>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
br label %8
8: ; preds = %3, %8
br label %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
br label %4
4: ; preds = %3, %4
br label %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_gettid;
int /*<<< orphan*/ syscall(int /*<<< orphan*/);
pid_t mygettid(void) { return syscall(SYS_gettid); }


x86 assembly (clang, -O0):
<mygettid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mygettid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@SYS_gettid = global i32 0
define i32 @mygettid() {
%1 = load i32, i32* @SYS_gettid
%2 = call i32 @syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@SYS_gettid = global i32 0
define i32 @mygettid() {
%1 = load i32, i32* @SYS_gettid
%2 = tail call i32 @syscall(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ IO_put_low_byte_hex(unsigned long);
void AB_output_hexadecimal(unsigned long int value) {
  if (value > 0xff)
    AB_output_hexadecimal(value >> 8);
  IO_put_low_byte_hex(value);
}


x86 assembly (clang, -O0):
<AB_output_hexadecimal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0xff,-0x8(%rbp)
jbe    1147 <AB_output_hexadecimal+0x27>
mov    -0x8(%rbp),%rdi
shr    $0x8,%rdi
call   1040 <AB_output_hexadecimal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <IO_put_low_byte_hex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AB_output_hexadecimal>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x100,%rdi
jb     1139 <AB_output_hexadecimal+0x19>
mov    %rbx,%rdi
shr    $0x8,%rdi
call   1040 <AB_output_hexadecimal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <IO_put_low_byte_hex@plt>

LLVM IR (-O0):
define void @AB_output_hexadecimal(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ugt i64 %3, 255
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = lshr i64 %6, 8
br label %8
8: ; preds = %5, %1
%9 = load i64, i64* %2
%10 = call i32 @IO_put_low_byte_hex(i64 %9)
ret void
}

LLVM IR (-O2):
define void @AB_output_hexadecimal(i64 %0) {
%2 = icmp ugt i64 %0, 255
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = lshr i64 %0, 8
tail call void @AB_output_hexadecimal(i64 %4)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @IO_put_low_byte_hex(i64 %0)
ret void
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_resolve_process(void *resolve) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_resolve_process>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ecf(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_resolve_process>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_resolve_process(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_resolve_process(i8* nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_bits(unsigned int x) {
  int i;
  for (i = (sizeof(int) * 8) - 1; i >= 0; i--)
    (x & (1 << i)) ? printf("1") : printf("0");
  printf("\n");
}


x86 assembly (clang, -O0):
<show_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1171 <show_bits+0x61>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1157 <show_bits+0x47>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1163 <show_bits+0x53>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <show_bits+0x12>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_bits>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1f,%ebp
nopw   0x0(%rax,%rax,1)
bt     %ebp,%ebx
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jb     1120 <show_bits+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @show_bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 31, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = shl i32 1, %9
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
15: ; preds = %7
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
br label %19
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, -1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @show_bits(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 31, %1 ], [ %9, %2 ]
%4 = shl nuw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 48, i32 49
%8 = tail call i32 @putchar(i32 %7)
%9 = add nsw i32 %3, -1
%10 = icmp eq i32 %3, 0
br i1 %10, label %11, label %2
11: ; preds = %2
%12 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int rpl_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
  if (str == NULL || size == 0) {
    {
      char foo[3];
      return vsnprintf(foo, 3, format, ap);
    }
  } else {
    return vsnprintf(str, size, format, ap);
  }
}


x86 assembly (clang, -O0):
<rpl_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113d <rpl_vsnprintf+0x2d>
cmpq   $0x0,-0x18(%rbp)
jne    115a <rpl_vsnprintf+0x4a>
lea    -0x27(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    $0x3,%esi
call   1030 <vsnprintf@plt>
mov    %eax,-0x4(%rbp)
jmp    1171 <rpl_vsnprintf+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpl_vsnprintf>:
test   %rdi,%rdi
je     111f <rpl_vsnprintf+0xf>
test   %rsi,%rsi
je     111f <rpl_vsnprintf+0xf>
jmp    1030 <vsnprintf@plt>
push   %rax
lea    0x5(%rsp),%rdi
mov    $0x3,%esi
call   1030 <vsnprintf@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @rpl_vsnprintf(i8* %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = alloca [3 x i8]
%6 = icmp eq i8* %0, null
%7 = icmp eq i64 %1, 0
%8 = or i1 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%11 = call i32 @vsnprintf(i8* %10, i64 3, i8* %2, i32 %3)
br label %14
12: ; preds = %4
%13 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
br label %14
14: ; preds = %12, %9
%15 = phi i32 [ %11, %9 ], [ %13, %12 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t size_t_ceil(size_t num, size_t den) {
  assert(den != 0);
  return (num + (den - 1)) / den;
}


x86 assembly (clang, -O0):
<size_t_ceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
add    %rcx,%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_t_ceil>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
lea    (%r14,%rbx,1),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
je     1143 <size_t_ceil+0x33>
xor    %edx,%edx
div    %rbx
jmp    1147 <size_t_ceil+0x37>
xor    %edx,%edx
div    %ebx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @size_t_ceil(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = sub i64 %10, 1
%12 = add i64 %9, %11
%13 = load i64, i64* %4
%14 = udiv i64 %12, %13
ret i64 %14
}

LLVM IR (-O2):
define i64 @size_t_ceil(i64 %0, i64 %1) {
%3 = icmp ne i64 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = add i64 %0, -1
%7 = add i64 %6, %1
%8 = udiv i64 %7, %1
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
void func_float(float f1, float f2) { printf("%f %f\n", f1, f2); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"%f %f\0A\00"
define void @func_float(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 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %5, float %6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%f %f\0A\00"
define void @func_float(float %0, float %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %0, float %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t stdlib_ndarray_get_ptr_float32(const uint8_t *idx, float *out) {
  *out = *(float *)idx;
  return 0;
}


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

x86 assembly (clang, -O2):
<stdlib_ndarray_get_ptr_float32>:
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @stdlib_ndarray_get_ptr_float32(i32* nocapture %0, float* nocapture writeonly %1) {
%3 = bitcast i32* %0 to float*
%4 = load float, float* %3
store float %4, float* %1
ret i32 0
}
unsigned uDivTest13(unsigned X, unsigned Y) { return X / (((unsigned)4) << Y); }


x86 assembly (clang, -O0):
<uDivTest13>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x4,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    %edx,%edx
div    %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDivTest13>:
mov    %edi,%eax
lea    0x2(%rsi),%ecx
shr    %cl,%eax
ret

LLVM IR (-O0):
define i32 @uDivTest13(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 = load i32, i32* %4
%7 = shl i32 4, %6
%8 = udiv i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @uDivTest13(i32 %0, i32 %1) {
%3 = add i32 %1, 2
%4 = lshr i32 %0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) { printf("Union find main\n"); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [16 x i8] c"Union find main\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printUsage(void) { printf("Usage: rmbigdir [-n thread_num] dirname\n"); }


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

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

LLVM IR (-O0):
@.str = [41 x i8] c"Usage: rmbigdir [-n thread_num] dirname\0A\00"
define void @printUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [40 x i8] c"Usage: rmbigdir [-n thread_num] dirname\00"
define void @printUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ pthread_t;

/* Variables and functions */
void clear_pids(pthread_t *t, int len) {
  int i;
  for (i = 0; i < len; i++)
    t[i] = (pthread_t)0;
  return;
}


x86 assembly (clang, -O0):
<clear_pids>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <clear_pids+0x3c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <clear_pids+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_pids>:
test   %esi,%esi
jle    1126 <clear_pids+0x16>
push   %rax
mov    %esi,%edx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @clear_pids(i64* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i64* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 3
br label %8
8: ; preds = %4, %2
ret void
}
int atm_header_get_pti(unsigned char *cell) { return ((cell[3] & 0x0e) >> 1); }


x86 assembly (clang, -O0):
<atm_header_get_pti>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
and    $0xe,%eax
sar    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atm_header_get_pti>:
movzbl 0x3(%rdi),%eax
shr    %eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @atm_header_get_pti(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = and i32 %6, 14
%8 = ashr i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @atm_header_get_pti(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = lshr i8 %3, 1
%5 = and i8 %4, 7
%6 = zext i8 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ three;
typedef int /*<<< orphan*/ hello;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void caveat(int three[], char hello[]) {
  printf("Caveat:\n");
  printf("items in three: %d / %d = %d\n", (int)sizeof(three),
         (int)sizeof(three[0]), (int)(sizeof(three) / sizeof((three)[0])));
  printf("items in hello: %d / %d = %d\n", (int)sizeof(hello),
         (int)sizeof(hello[0]), (int)(sizeof(hello) / sizeof((hello)[0])));
}


x86 assembly (clang, -O0):
<caveat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x8,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caveat>:
push   %rax
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    $0x8,%ecx
xor    %eax,%eax
pop    %r8
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Caveat:\0A\00"
@.str.1 = [30 x i8] c"items in three: %d / %d = %d\0A\00"
@.str.2 = [30 x i8] c"items in hello: %d / %d = %d\0A\00"
define void @caveat(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 4, i32 2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 1, i32 8)
ret void
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"items in three: %d / %d = %d\0A\00"
@.str.2 = [30 x i8] c"items in hello: %d / %d = %d\0A\00"
@str = [8 x i8] c"Caveat:\00"
define void @caveat(i32* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 4, i32 2)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 1, i32 8)
ret void
}
char *reverse_string(char *s) { return ""; }


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @reverse_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @reverse_string(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
void dump_dirent(unsigned char *entry) {
  int n;
  ;
  for (n = 0; n < 16; n++) {
    ;
  }
  for (n = 0; n < 16; n++) {
    ;
  };
  for (n = 16; n < 32; n++) {
    ;
  }
  for (n = 16; n < 32; n++) {
    ;
  };
}


x86 assembly (clang, -O0):
<dump_dirent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    112c <dump_dirent+0x2c>
jmp    111e <dump_dirent+0x1e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <dump_dirent+0xf>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1150 <dump_dirent+0x50>
jmp    1142 <dump_dirent+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <dump_dirent+0x33>
movl   $0x10,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1174 <dump_dirent+0x74>
jmp    1166 <dump_dirent+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <dump_dirent+0x57>
movl   $0x10,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1198 <dump_dirent+0x98>
jmp    118a <dump_dirent+0x8a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117b <dump_dirent+0x7b>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @dump_dirent(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
scalar_t__ sqrt(unsigned long long);
int main() {
  unsigned long long n;
  scanf("%lld", &n);
  printf("%ld\n", (unsigned long)sqrt(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <sqrt@plt>
mov    %rax,%rsi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rdi
call   1050 <sqrt@plt>
lea    0xeb5(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = call i64 @sqrt(i64 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %5)
ret i32 0
}
int from() {}


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

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

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

LLVM IR (-O2):
define i32 @from() {
ret i32 undef
}
int compare(const void *a, const void *b) {
  if (*(int *)a < *(int *)b)
    return -1;
  else if (*(int *)a == *(int *)b)
    return 0;
  else if (*(int *)a > *(int *)b)
    return 1;
  return -2;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    112a <compare+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <compare+0x77>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    1148 <compare+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1177 <compare+0x77>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    1166 <compare+0x66>
movl   $0x1,-0x4(%rbp)
jmp    1177 <compare+0x77>
jmp    116b <compare+0x6b>
jmp    1170 <compare+0x70>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%ecx
mov    (%rsi),%edx
mov    $0xffffffff,%eax
cmp    %edx,%ecx
jl     111f <compare+0x1f>
xor    %eax,%eax
cmp    %edx,%ecx
je     111f <compare+0x1f>
setg   %al
movzbl %al,%eax
lea    (%rax,%rax,2),%eax
add    $0xfffffffe,%eax
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = icmp slt i32 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %35
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = load i8*, i8** %5
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
%21 = icmp eq i32 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 0, i32* %3
br label %35
23: ; preds = %14
%24 = load i8*, i8** %4
%25 = bitcast i8* %24 to i32*
%26 = load i32, i32* %25
%27 = load i8*, i8** %5
%28 = bitcast i8* %27 to i32*
%29 = load i32, i32* %28
%30 = icmp sgt i32 %26, %29
br i1 %30, label %31, label %32
31: ; preds = %23
store i32 1, i32* %3
br label %35
32: ; preds = %23
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
store i32 -2, i32* %3
br label %35
35: ; preds = %34, %31, %22, %13
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = icmp eq i32 %4, %6
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = icmp sgt i32 %4, %6
%12 = select i1 %11, i32 1, i32 -2
br label %13
13: ; preds = %10, %8, %2
%14 = phi i32 [ -1, %2 ], [ 0, %8 ], [ %12, %10 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ b();
void a(void) { b(); }


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

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

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

LLVM IR (-O2):
define void @a() {
%1 = tail call i32 (...) @b()
ret void
}
/* Variables and functions */
int atoi(char const *);
double dice6(int, int, int);
int /*<<< orphan*/ printf(char *, int, double);
int main(int nargs, const char *argv[]) {
  int N = atoi(argv[1]);
  int ndice = 6;
  int nsix = 3;
  double p = dice6(N, ndice, nsix);
  printf("C code: N=%d, p=%.6f\n", N, p);
  return 0;
}


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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x6,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <dice6@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x6,%esi
mov    $0x3,%edx
call   1040 <dice6@plt>
lea    0xeac(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"C code: N=%d, p=%.6f\0A\00"
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 double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
store i32 6, i32* %7
store i32 3, i32* %8
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = call double @dice6(i32 %14, i32 %15, i32 %16)
store double %17, double* %9
%18 = load i32, i32* %6
%19 = load double, double* %9
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %18, double %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"C code: N=%d, p=%.6f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call double @dice6(i32 %5, i32 6, i32 3)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %5, double %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
void sprint_orl_Rn(char *str, unsigned char n) {
  sprintf(str, "ORL   A, R%X                     ", n);
}


x86 assembly (clang, -O0):
<sprint_orl_Rn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_orl_Rn>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"ORL A, R%X \00"
define void @sprint_orl_Rn(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"ORL A, R%X \00"
define void @sprint_orl_Rn(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}