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

/* Variables and functions */
scalar_t__ wcslen(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *wmemmove(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                             scalar_t__);
wchar_t *wcsmove(wchar_t *whither, const wchar_t *whence) {
  return wmemmove(whither, whence, wcslen(whence) + 1);
}


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

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

LLVM IR (-O0):
define i32* @wcsmove(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 = load i32*, i32** %4
%8 = call i64 @wcslen(i32* %7)
%9 = add nsw i64 %8, 1
%10 = call i32* @wmemmove(i32* %5, i32* %6, i64 %9)
ret i32* %10
}

LLVM IR (-O2):
define i32* @wcsmove(i32* %0, i32* %1) {
%3 = tail call i64 @wcslen(i32* %1)
%4 = add nsw i64 %3, 1
%5 = tail call i32* @wmemmove(i32* %0, i32* %1, i64 %4)
ret i32* %5
}
/* Variables and functions */
unsigned char *BM(char *, int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
char *tc_004() {
  unsigned char *rel =
      BM("1234567890", strlen("1234567890"), "8901", strlen("8901"));
  do {
    return NULL == rel ? NULL : "expect NULL pointer";
  } while (0);
  ;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <strlen@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%ecx
lea    0xeb1(%rip),%rdi
lea    0xeb5(%rip),%rdx
call   1040 <BM@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    0xea2(%rip),%rax
cmp    %rdx,%rcx
cmove  %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r14
push   %rbx
lea    0xed5(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xecf(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <BM@plt>
test   %rax,%rax
lea    0xeb3(%rip),%rcx
cmovne %rcx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"1234567890\00"
@.str.1 = [5 x i8] c"8901\00"
@.str.2 = [20 x i8] c"expect NULL pointer\00"
define i8* @tc_004() {
%1 = alloca i8*
%2 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = call i8* @BM(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
store i8* %4, i8** %1
br label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = icmp eq i8* null, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* null, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
br label %10
10: ; preds = %5
ret i8* %9
}

LLVM IR (-O2):
@.str = [11 x i8] c"1234567890\00"
@.str.1 = [5 x i8] c"8901\00"
@.str.2 = [20 x i8] c"expect NULL pointer\00"
define i8* @tc_004() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i8* @BM(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* null, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
ret i8* %5
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void bm_set(uint8_t *bm, uint16_t v) {
  uint16_t page_idx = (v >> 3);
  uint8_t bit_idx = (uint8_t)(v & 0x07);
  bm[page_idx] |= (1 << bit_idx);
}


x86 assembly (clang, -O0):
<bm_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bm_set>:
mov    %esi,%ecx
mov    %esi,%eax
sar    $0x3,%eax
and    $0x7,%cl
mov    $0x1,%edx
shl    %cl,%edx
cltq
or     %edx,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @bm_set(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = ashr i32 %7, 3
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = and i32 %9, 7
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = shl i32 1, %11
%13 = load i32*, i32** %3
%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 = or i32 %17, %12
store i32 %18, i32* %16
ret void
}

LLVM IR (-O2):
define void @bm_set(i32* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 3
%4 = and i32 %1, 7
%5 = shl nuw nsw i32 1, %4
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = or i32 %8, %5
store i32 %9, i32* %7
ret void
}
/* Variables and functions */
unsigned long HSN2RGB100(unsigned long);
unsigned long hsn2rgb(unsigned long hsn) { return HSN2RGB100(hsn); }


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

x86 assembly (clang, -O2):
<hsn2rgb>:
jmp    1030 <HSN2RGB100@plt>

LLVM IR (-O0):
define i64 @hsn2rgb(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @HSN2RGB100(i64 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @hsn2rgb(i64 %0) {
%2 = tail call i64 @HSN2RGB100(i64 %0)
ret i64 %2
}
/* Type definitions */
struct Cyc_Absyn_Exp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_Tcutil_cnst_exp(int /*<<< orphan*/,
                                       struct Cyc_Absyn_Exp *);
int Cyc_Tcutil_is_const_exp(struct Cyc_Absyn_Exp *e) {
  return ({ Cyc_Tcutil_cnst_exp(0, e); });
}


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

x86 assembly (clang, -O2):
<Cyc_Tcutil_is_const_exp>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <Cyc_Tcutil_cnst_exp@plt>

LLVM IR (-O0):
%struct.Cyc_Absyn_Exp = type { i32 }
define i32 @Cyc_Tcutil_is_const_exp(%struct.Cyc_Absyn_Exp* %0) {
%2 = alloca %struct.Cyc_Absyn_Exp*
%3 = alloca i32
store %struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp** %2
%4 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %2
%5 = call i32 @Cyc_Tcutil_cnst_exp(i32 0, %struct.Cyc_Absyn_Exp* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.Cyc_Absyn_Exp = type { i32 }
define i32 @Cyc_Tcutil_is_const_exp(%struct.Cyc_Absyn_Exp* %0) {
%2 = tail call i32 @Cyc_Tcutil_cnst_exp(i32 0, %struct.Cyc_Absyn_Exp* %0)
ret i32 %2
}
unsigned long long hh(unsigned long long a) { return a & 0x10300000000ull; }


x86 assembly (clang, -O0):
<hh>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0x10300000000,%rax
and    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hh>:
movabs $0x10300000000,%rax
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @hh(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 1112396529664
ret i64 %4
}

LLVM IR (-O2):
define i64 @hh(i64 %0) {
%2 = and i64 %0, 1112396529664
ret i64 %2
}
int pldummy_xfig() { return 0; }


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

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

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

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

/* Variables and functions */
int syscall(int, struct sysinfo *);
int __lsysinfo(struct sysinfo *info) { return syscall(116, info); }


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

x86 assembly (clang, -O2):
<__lsysinfo>:
mov    %rdi,%rsi
mov    $0x74,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.sysinfo = type { i32 }
define i32 @__lsysinfo(%struct.sysinfo* %0) {
%2 = alloca %struct.sysinfo*
store %struct.sysinfo* %0, %struct.sysinfo** %2
%3 = load %struct.sysinfo*, %struct.sysinfo** %2
%4 = call i32 @syscall(i32 116, %struct.sysinfo* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.sysinfo = type { i32 }
define i32 @__lsysinfo(%struct.sysinfo* %0) {
%2 = tail call i32 @syscall(i32 116, %struct.sysinfo* %0)
ret i32 %2
}
/* Variables and functions */
int _dl_write(int fd, char const *str, size_t len) {
  (void)fd;
  (void)str;
  (void)len;
  return -1;
}


x86 assembly (clang, -O0):
<_dl_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @_dl_write(i32 %0, i8* nocapture readnone %1, i64 %2) {
ret i32 -1
}
/* Type definitions */
struct sync_file_info {
  scalar_t__ sync_fence_info;
};
struct sync_fence_info {
  int dummy;
};

/* Variables and functions */
struct sync_fence_info *sync_get_fence_info(const struct sync_file_info *info) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
  return (struct sync_fence_info *)(uintptr_t)(info->sync_fence_info);
#pragma GCC diagnostic pop
}


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

x86 assembly (clang, -O2):
<sync_get_fence_info>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.sync_fence_info = type { i32 }
%struct.sync_file_info = type { i64 }
define %struct.sync_fence_info* @sync_get_fence_info(%struct.sync_file_info* %0) {
%2 = alloca %struct.sync_file_info*
store %struct.sync_file_info* %0, %struct.sync_file_info** %2
%3 = load %struct.sync_file_info*, %struct.sync_file_info** %2
%4 = getelementptr inbounds %struct.sync_file_info, %struct.sync_file_info* %3, i32 0, i32 0
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to %struct.sync_fence_info*
ret %struct.sync_fence_info* %6
}

LLVM IR (-O2):
%struct.sync_fence_info = type { i32 }
%struct.sync_file_info = type { i64 }
define %struct.sync_fence_info* @sync_get_fence_info(%struct.sync_file_info* nocapture %0) {
%2 = getelementptr inbounds %struct.sync_file_info, %struct.sync_file_info* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to %struct.sync_fence_info*
ret %struct.sync_fence_info* %4
}
/* Variables and functions */
char *strerror(int);
char *check_strerror(char *buffer, size_t numberOfBytes, int error) {
  return strerror(error);
}


x86 assembly (clang, -O0):
<check_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <strerror@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_strerror>:
mov    %edx,%edi
jmp    1030 <strerror@plt>

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

LLVM IR (-O2):
define i8* @check_strerror(i8* nocapture readnone %0, i64 %1, i32 %2) {
%4 = tail call i8* @strerror(i32 %2)
ret i8* %4
}
void builtin_car(struct Context *ctx, unsigned int stack_track) {}


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

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

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

LLVM IR (-O2):
%struct.Context = type opaque
define void @builtin_car(%struct.Context* nocapture %0, i32 %1) {
ret void
}
int test_imm_D9uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xD9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D9uint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0xd9,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D9uint64_highword_reg>:
movabs $0xd900000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D9uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 932007903232
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void _reset_console_color() {}


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

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

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

LLVM IR (-O2):
define void @_reset_console_color() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int parse_func(char *key, char *val, void *arg) {
  printf("[%s] = [%s]\n", key, val);
  return 0;
}


x86 assembly (clang, -O0):
<parse_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_func>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"[%s] = [%s]\0A\00"
define i32 @parse_func(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"[%s] = [%s]\0A\00"
define i32 @parse_func(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, double, double);
void usage(char *argv[]) {
  printf("Usage: %s.x \n"
         "\t--outer-repetitions <outer-repetitions> (default %d)\n"
         "\t--test-time <target-test-time> (default %0.2f microseconds)\n"
         "\t--delay-time <delay-time> (default %0.4f microseconds)\n"
         "\t--delay-length <delay-length> "
         "(default auto-generated based on processor speed)\n",
         argv[0], 20, 1000.0, 0.10);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xee6(%rip),%rdi
mov    $0x14,%edx
movsd  0xec9(%rip),%xmm0
movsd  0xec9(%rip),%xmm1
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    (%rdi),%rsi
lea    0xef6(%rip),%rdi
movsd  0xede(%rip),%xmm0
movsd  0xede(%rip),%xmm1
mov    $0x14,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [266 x i8] c"Usage: %s.x \0A\09--outer-repetitions <outer-repetitions> (default %d)\0A\09--test-time <target-test-time> (default %0.2f microseconds)\0A\09--delay-time <delay-time> (default %0.4f microseconds)\0A\09--delay-length <delay-length> (default auto-generated based on processor speed)\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([266 x i8], [266 x i8]* @.str, i64 0, i64 0), i8* %5, i32 20, double 1.000000e+03, double 1.000000e-01)
ret void
}

LLVM IR (-O2):
@.str = [266 x i8] c"Usage: %s.x \0A\09--outer-repetitions <outer-repetitions> (default %d)\0A\09--test-time <target-test-time> (default %0.2f microseconds)\0A\09--delay-time <delay-time> (default %0.4f microseconds)\0A\09--delay-length <delay-length> (default auto-generated based on processor speed)\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([266 x i8], [266 x i8]* @.str, i64 0, i64 0), i8* %2, i32 20, double 1.000000e+03, double 1.000000e-01)
ret void
}
/* Type definitions */
struct dlist_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __dlist_del_entry(struct dlist_node *);
int /*<<< orphan*/ dlist_add(struct dlist_node *, struct dlist_node *);
void dlist_move(struct dlist_node *list, struct dlist_node *head) {
  __dlist_del_entry(list);
  dlist_add(list, head);
}


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

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

LLVM IR (-O0):
%struct.dlist_node = type { i32 }
define void @dlist_move(%struct.dlist_node* %0, %struct.dlist_node* %1) {
%3 = alloca %struct.dlist_node*
%4 = alloca %struct.dlist_node*
store %struct.dlist_node* %0, %struct.dlist_node** %3
store %struct.dlist_node* %1, %struct.dlist_node** %4
%5 = load %struct.dlist_node*, %struct.dlist_node** %3
%6 = call i32 @__dlist_del_entry(%struct.dlist_node* %5)
%7 = load %struct.dlist_node*, %struct.dlist_node** %3
%8 = load %struct.dlist_node*, %struct.dlist_node** %4
%9 = call i32 @dlist_add(%struct.dlist_node* %7, %struct.dlist_node* %8)
ret void
}

LLVM IR (-O2):
%struct.dlist_node = type { i32 }
define void @dlist_move(%struct.dlist_node* %0, %struct.dlist_node* %1) {
%3 = tail call i32 @__dlist_del_entry(%struct.dlist_node* %0)
%4 = tail call i32 @dlist_add(%struct.dlist_node* %0, %struct.dlist_node* %1)
ret void
}
/* Type definitions */
struct timeval {
  long tv_usec;
  long tv_sec;
};

/* Variables and functions */
struct timeval usec_to_timeval(long int usec) {
  struct timeval temp;
  temp.tv_usec = usec % 1000000L;
  temp.tv_sec = usec / 1000000L;
  return temp;
}


x86 assembly (clang, -O0):
<usec_to_timeval>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movabs $0x431bde82d7b634db,%rcx
de 1b 43
imul   %rcx
mov    -0x20(%rbp),%rax
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x12,%rdx
add    %rsi,%rdx
imul   $0xf4240,%rdx,%rdx
sub    %rdx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
imul   %rcx
mov    %rdx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x12,%rax
add    %rdx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<usec_to_timeval>:
movabs $0x431bde82d7b634db,%rcx
de 1b 43
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%rdi
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define { i64, i64 } @usec_to_timeval(i64 %0) {
%2 = alloca %struct.timeval
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = srem i64 %4, 1000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
store i64 %5, i64* %6
%7 = load i64, i64* %3
%8 = sdiv i64 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
store i64 %8, i64* %9
%10 = bitcast %struct.timeval* %2 to { i64, i64 }*
%11 = load { i64, i64 }, { i64, i64 }* %10
ret { i64, i64 } %11
}

LLVM IR (-O2):
define { i64, i64 } @usec_to_timeval(i64 %0) {
%2 = srem i64 %0, 1000000
%3 = sdiv i64 %0, 1000000
%4 = insertvalue { i64, i64 } poison, i64 %2, 0
%5 = insertvalue { i64, i64 } %4, i64 %3, 1
ret { i64, i64 } %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rte_align32pow2(uint32_t x) {
  x--;
  x |= x >> 1;
  x |= x >> 2;
  x |= x >> 4;
  x |= x >> 8;
  x |= x >> 16;
  return x + 1;
}


x86 assembly (clang, -O0):
<rte_align32pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_align32pow2>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
sar    %ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
sar    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
sar    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @rte_align32pow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
define i32 @rte_align32pow2(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = ashr i32 %2, 1
%4 = or i32 %3, %2
%5 = ashr i32 %4, 2
%6 = or i32 %5, %4
%7 = ashr i32 %6, 4
%8 = or i32 %7, %6
%9 = ashr i32 %8, 8
%10 = or i32 %9, %8
%11 = ashr i32 %10, 16
%12 = or i32 %11, %10
%13 = add nsw i32 %12, 1
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ print(char *, int);
int fputc_overriden(int ch, FILE *f) {
  char tempch = ch;
  switch (tempch) {
  case '\n':
    print("\r\n", 2);
    break;
  default:
    print(&tempch, 1);
    break;
  }
  return ch;
}


x86 assembly (clang, -O0):
<fputc_overriden>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
sub    $0xa,%al
jne    114b <fputc_overriden+0x3b>
jmp    1135 <fputc_overriden+0x25>
lea    0xec4(%rip),%rdi
mov    $0x2,%esi
call   1030 <print@plt>
jmp    1159 <fputc_overriden+0x49>
lea    -0x11(%rbp),%rdi
mov    $0x1,%esi
call   1030 <print@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputc_overriden>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %bl,0xf(%rsp)
cmp    $0xa,%bl
jne    112e <fputc_overriden+0x1e>
lea    0xed9(%rip),%rdi
mov    $0x2,%esi
jmp    1138 <fputc_overriden+0x28>
lea    0xf(%rsp),%rdi
mov    $0x1,%esi
call   1030 <print@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @fputc_overriden(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = trunc i32 %6 to i8
store i8 %7, i8* %5
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
switch i32 %9, label %12 [
i32 10, label %10
]
10: ; preds = %2
%11 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
br label %14
12: ; preds = %2
%13 = call i32 @print(i8* %5, i32 1)
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define i32 @fputc_overriden(i32 returned %0, i32* nocapture readnone %1) {
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = and i32 %0, 255
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
br label %11
9: ; preds = %2
%10 = call i32 @print(i8* %3, i32 1)
br label %11
11: ; preds = %9, %7
ret i32 %0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  short x;
};
typedef TYPE_1__ XPoint;

/* Variables and functions */
void set_XPoint_x(void *_p, short _v) { ((XPoint *)_p)->x = (short)_v; }


x86 assembly (clang, -O0):
<set_XPoint_x>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XPoint_x>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i16 }
define void @set_XPoint_x(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i16 %5, i16* %8
ret void
}

LLVM IR (-O2):
define void @set_XPoint_x(i8* nocapture writeonly %0, i16 signext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ max_heapify(int *, int, int);
void build_max_heap(int array[], int size) {
  int i;
  for (i = (size / 2) - 1; i >= 0; i--) {
    max_heapify(array, i, size);
  }
}


x86 assembly (clang, -O0):
<build_max_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1157 <build_max_heap+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <max_heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <build_max_heap+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_max_heap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1145 <build_max_heap+0x35>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x2(%rbx),%esi
mov    %r14,%rdi
mov    %ebp,%edx
call   1030 <max_heapify@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1130 <build_max_heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @build_max_heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %8, %6 ], [ %5, %4 ]
%8 = add nsw i32 %7, -1
%9 = tail call i32 @max_heapify(i32* %0, i32 %8, i32 %1)
%10 = icmp ugt i32 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
ret void
}
double ddiv(double a, double b) { return a / b; }


x86 assembly (clang, -O0):
<ddiv>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ddiv>:
divsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @ddiv(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Variables and functions */
int isdigit(char c) { return (c >= '0' && c <= '9'); }


x86 assembly (clang, -O0):
<isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isdigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
int ft_strlen(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0')
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <ft_strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ft_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <ft_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @ft_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t read_be16(const uint8_t *bytes) { return (bytes[0] << 8) | bytes[1]; }


x86 assembly (clang, -O0):
<read_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_be16>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read_be16(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @read_be16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ newlin();
int /*<<< orphan*/ rerdcm();
int /*<<< orphan*/ stdout;
void complain_cvmba(void) {
  newlin();
  fputs("Command verb must be alphabetic", stdout);
  rerdcm();
}


x86 assembly (clang, -O0):
<complain_cvmba>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <newlin@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x0,%al
call   1040 <rerdcm@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<complain_cvmba>:
push   %rax
xor    %eax,%eax
call   1050 <newlin@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <rerdcm@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Command verb must be alphabetic\00"
@stdout = global i32 0
define void @complain_cvmba() {
%1 = call i32 (...) @newlin()
%2 = load i32, i32* @stdout
%3 = call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 (...) @rerdcm()
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Command verb must be alphabetic\00"
@stdout = global i32 0
define void @complain_cvmba() {
%1 = tail call i32 (...) @newlin()
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 (...) @rerdcm()
ret void
}
int iasecc_sdo_encode_update_field() { return -1408; }


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

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

LLVM IR (-O0):
define i32 @iasecc_sdo_encode_update_field() {
ret i32 -1408
}

LLVM IR (-O2):
define i32 @iasecc_sdo_encode_update_field() {
ret i32 -1408
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void myfunc() { printf("myfunc() called\n"); }


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"myfunc() called\00"
define void @myfunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getNumber(double *);
double sin(double);
double seno(double a) {
  getNumber(&a);
  return sin(a);
}


x86 assembly (clang, -O0):
<seno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <getNumber@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seno>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <getNumber@plt>
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
pop    %rax
ret

LLVM IR (-O0):
define double @seno(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @getNumber(double* %2)
%4 = load double, double* %2
%5 = call double @sin(double %4)
ret double %5
}

LLVM IR (-O2):
define double @seno(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @getNumber(double* %2)
%4 = load double, double* %2
%5 = call double @sin(double %4)
ret double %5
}
/* Variables and functions */
int inb(int);
void smbus_wait_until_ready(void) {
  while ((inb(0x1000) & 1) == 1) {
  }
}


x86 assembly (clang, -O0):
<smbus_wait_until_ready>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <smbus_wait_until_ready+0x9>
mov    $0x1000,%edi
call   1030 <inb@plt>
and    $0x1,%eax
cmp    $0x1,%eax
jne    1134 <smbus_wait_until_ready+0x24>
jmp    1119 <smbus_wait_until_ready+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbus_wait_until_ready>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1000,%edi
call   1030 <inb@plt>
test   $0x1,%al
jne    1120 <smbus_wait_until_ready+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @smbus_wait_until_ready() {
br label %1
1: ; preds = %5, %0
%2 = call i32 @inb(i32 4096)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @smbus_wait_until_ready() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @inb(i32 4096)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
ret void
}
__attribute__((always_)) int trace_printk(const char *fmt, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @trace_printk(i8* nocapture readnone %0, ...) {
ret i32 0
}
void ini_free_array(char **array, int num) {
  int i;
  for (i = 0; i < num; i++) {
    if (array[i])
      free(array[i]);
  }
  free(array);
}


x86 assembly (clang, -O0):
<ini_free_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <ini_free_array+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1156 <ini_free_array+0x46>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    115b <ini_free_array+0x4b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <ini_free_array+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ini_free_array>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1149 <ini_free_array+0x39>
mov    %esi,%r15d
xor    %ebx,%ebx
jmp    1139 <ini_free_array+0x29>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%r15
je     1149 <ini_free_array+0x39>
mov    (%r14,%rbx,8),%rdi
test   %rdi,%rdi
je     1130 <ini_free_array+0x20>
call   1030 <free@plt>
jmp    1130 <ini_free_array+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @ini_free_array(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %12
%7 = phi i64 [ 0, %4 ], [ %13, %12 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %6
tail call void @free(i8* %9)
br label %12
12: ; preds = %6, %11
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %12, %2
%16 = bitcast i8** %0 to i8*
tail call void @free(i8* %16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void Usage(char *prog_name) {
  fprintf(stderr, "usage: %s <number of threads>\n", prog_name);
  exit(0);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"usage: %s <number of threads>\0A\00"
define void @Usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"usage: %s <number of threads>\0A\00"
define void @Usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 0)
unreachable
}
int do_compare_file(const char *filename, const char *base) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @do_compare_file(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 1
}
int CalculateUsedBits(int bits) {
  int bit_count = 0;
  unsigned bit = 1;
  for (unsigned i = 0; i < 32; i++) {
    if ((bits & bit) == bit) {
      bit_count++;
    }
    bit <<= 1;
  }
  return bit_count;
}


x86 assembly (clang, -O0):
<CalculateUsedBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jae    1155 <CalculateUsedBits+0x55>
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    113e <CalculateUsedBits+0x3e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111c <CalculateUsedBits+0x1c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateUsedBits>:
xor    %eax,%eax
mov    $0x1,%ecx
mov    $0x20,%edx
not    %edi
xchg   %ax,%ax
mov    %ecx,%esi
and    %edi,%esi
cmp    $0x1,%esi
adc    $0x0,%eax
lea    (%rcx,%rcx,1),%esi
and    %edi,%esi
cmp    $0x1,%esi
adc    $0x0,%eax
lea    0x0(,%rcx,4),%esi
and    %edi,%esi
cmp    $0x1,%esi
adc    $0x0,%eax
lea    0x0(,%rcx,8),%esi
and    %edi,%esi
cmp    $0x1,%esi
adc    $0x0,%eax
shl    $0x4,%ecx
add    $0xfffffffc,%edx
jne    1110 <CalculateUsedBits+0x10>
ret

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

LLVM IR (-O2):
define i32 @CalculateUsedBits(i32 %0) {
br label %3
2: ; preds = %3
ret i32 %25
3: ; preds = %3, %1
%4 = phi i32 [ 0, %1 ], [ %27, %3 ]
%5 = phi i32 [ 1, %1 ], [ %26, %3 ]
%6 = phi i32 [ 0, %1 ], [ %25, %3 ]
%7 = and i32 %5, %0
%8 = icmp eq i32 %7, %5
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %6, %9
%11 = shl i32 %5, 1
%12 = and i32 %11, %0
%13 = icmp eq i32 %12, %11
%14 = zext i1 %13 to i32
%15 = add nuw nsw i32 %10, %14
%16 = shl i32 %5, 2
%17 = and i32 %16, %0
%18 = icmp eq i32 %17, %16
%19 = zext i1 %18 to i32
%20 = add nuw nsw i32 %15, %19
%21 = shl i32 %5, 3
%22 = and i32 %21, %0
%23 = icmp eq i32 %22, %21
%24 = zext i1 %23 to i32
%25 = add nuw nsw i32 %20, %24
%26 = shl i32 %5, 4
%27 = add nuw nsw i32 %4, 4
%28 = icmp eq i32 %27, 32
br i1 %28, label %2, label %3
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_RADIO_VREF_PIN() { return 0x01 & (inp_emulate(-2) >> 1); }


x86 assembly (clang, -O0):
<TOSH_READ_RADIO_VREF_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
sar    $0x1,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_RADIO_VREF_PIN>:
push   %rax
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
shr    %al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_RADIO_VREF_PIN() {
%1 = call i32 @inp_emulate(i32 -2)
%2 = ashr i32 %1, 1
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_RADIO_VREF_PIN() {
%1 = tail call i32 @inp_emulate(i32 -2)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 1
%4 = and i8 %3, 1
ret i8 %4
}