xunge/DecIR huggingface dataset:
char *add_many_strings(n, s1, s2, s3, s4, s5)
int n;
char *s1, *s2, *s3, *s4, *s5;
{ return 0; }


x86 assembly (clang, -O0):
<add_many_strings>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @add_many_strings(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @add_many_strings(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
ret i8* null
}
void steal_heart(struct battle_char *origin, struct battle_char *target) {}


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

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

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

LLVM IR (-O2):
%struct.battle_char = type opaque
define void @steal_heart(%struct.battle_char* nocapture %0, %struct.battle_char* nocapture %1) {
ret void
}
/* Variables and functions */
size_t UINT16_MAX;
size_t ece_min_block_pad_length(size_t, size_t);
size_t ece_aesgcm_min_block_pad_length(size_t padLen, size_t maxBlockLen) {
  size_t blockPadLen = ece_min_block_pad_length(padLen, maxBlockLen);
  return blockPadLen > UINT16_MAX ? UINT16_MAX : blockPadLen;
}


x86 assembly (clang, -O0):
<ece_aesgcm_min_block_pad_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ece_min_block_pad_length@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2ea4(%rip),%rcx
cmp    (%rcx),%rax
jbe    1158 <ece_aesgcm_min_block_pad_length+0x48>
mov    0x2e94(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1160 <ece_aesgcm_min_block_pad_length+0x50>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ece_aesgcm_min_block_pad_length>:
push   %rax
call   1030 <ece_min_block_pad_length@plt>
mov    0x2ec3(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,%rax
cmova  %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@UINT16_MAX = global i64 0
define i64 @ece_aesgcm_min_block_pad_length(i64 %0, i64 %1) {
%3 = tail call i64 @ece_min_block_pad_length(i64 %0, i64 %1)
%4 = load i64, i64* @UINT16_MAX
%5 = icmp ugt i64 %3, %4
%6 = select i1 %5, i64 %4, i64 %3
ret i64 %6
}
const char *rndrm00_get_title(void) {
  return "Randomly create and remove directories and files";
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"Randomly create and remove directories and files\00"
define i8* @rndrm00_get_title() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [49 x i8] c"Randomly create and remove directories and files\00"
define i8* @rndrm00_get_title() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}
int vrt_msg_reintegrate_device(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @vrt_msg_reintegrate_device() {
ret i32 0
}
char *procprt_VSLIBS_e(struct tstat *curstat, int avgval, int nsecs) {
  return "    0K";
}


x86 assembly (clang, -O0):
<procprt_VSLIBS_e>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeeb(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tstat = type opaque
@.str = [7 x i8] c" 0K\00"
define i8* @procprt_VSLIBS_e(%struct.tstat* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tstat*
%5 = alloca i32
%6 = alloca i32
store %struct.tstat* %0, %struct.tstat** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tstat = type opaque
@.str = [7 x i8] c" 0K\00"
define i8* @procprt_VSLIBS_e(%struct.tstat* nocapture readnone %0, i32 %1, i32 %2) {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
size_t mbrtowc(int /*<<< orphan*/, char const *, size_t, int /*<<< orphan*/ *);
size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict ps) {
  static mbstate_t sps;
  return (mbrtowc(0, s, n, ps ? ps : &sps));
}


x86 assembly (clang, -O0):
<mbrlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114c <mbrlen+0x3c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    115c <mbrlen+0x4c>
lea    0x2ed9(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    115c <mbrlen+0x4c>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rcx
xor    %edi,%edi
call   1030 <mbrtowc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbrlen>:
mov    %rsi,%rax
mov    %rdi,%rsi
test   %rdx,%rdx
lea    0x2f0c(%rip),%rcx
cmovne %rdx,%rcx
xor    %edi,%edi
mov    %rax,%rdx
jmp    1030 <mbrtowc@plt>

LLVM IR (-O0):
@mbrlen.sps = internal global i32 0
define i64 @mbrlen(i8* noalias %0, i64 %1, i32* noalias %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 i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i32*, i32** %6
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i32*, i32** %6
br label %14
13: ; preds = %3
br label %14
14: ; preds = %13, %11
%15 = phi i32* [ %12, %11 ], [ @mbrlen.sps, %13 ]
%16 = call i64 @mbrtowc(i32 0, i8* %7, i64 %8, i32* %15)
ret i64 %16
}

LLVM IR (-O2):
@mbrlen.sps = internal global i32 0
define i64 @mbrlen(i8* noalias %0, i64 %1, i32* noalias %2) {
%4 = icmp eq i32* %2, null
%5 = select i1 %4, i32* @mbrlen.sps, i32* %2
%6 = tail call i64 @mbrtowc(i32 0, i8* %0, i64 %1, i32* %5)
ret i64 %6
}
char cast_uint_char(unsigned int x) { return (char)x; }


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

x86 assembly (clang, -O2):
<cast_uint_char>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @cast_uint_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @cast_uint_char(i32 %0) {
%2 = trunc i32 %0 to i8
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ my_malloc();
void testOnlyRefferToVisibleVariables() { my_malloc(); }


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

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

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

LLVM IR (-O2):
define void @testOnlyRefferToVisibleVariables() {
%1 = tail call i32 (...) @my_malloc()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void prIndent(int indent, FILE *fp) {
  while (indent--)
    fprintf(fp, "    ");
}


x86 assembly (clang, -O0):
<prIndent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1148 <prIndent+0x38>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
jmp    111f <prIndent+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prIndent>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
je     114a <prIndent+0x3a>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xedc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rdi
mov    %rbx,%rcx
call   1030 <fwrite@plt>
add    $0xffffffff,%ebp
jne    1130 <prIndent+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
define void @prIndent(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, -1
store i32 %7, i32* %3
%8 = icmp ne i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32*, i32** %4
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
define void @prIndent(i32 %0, i32* nocapture %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %1)
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: address [type [ data ] ]\n");
  fprintf(stderr, "  address : memory address\n");
  fprintf(stderr,
          "  type    : access operation : [b]yte [h]alfword [w]ord [d]word\n");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee2(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"usage: address [type [ data ] ]\0A\00"
@.str.1 = [28 x i8] c" address : memory address\0A\00"
@.str.2 = [65 x i8] c" type : access operation : [b]yte [h]alfword [w]ord [d]word\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"usage: address [type [ data ] ]\0A\00"
@.str.1 = [28 x i8] c" address : memory address\0A\00"
@.str.2 = [65 x i8] c" type : access operation : [b]yte [h]alfword [w]ord [d]word\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @exit(i32 2)
unreachable
}
int test_imm_2Bint64_lowword_reg(long long val) {
  return ((val) & (0x2B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_2Bint64_lowword_reg>:
test   $0x2b,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Bint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 43
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void *f(void **p) { return p[1]; }


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

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

LLVM IR (-O0):
define i8* @f(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 1
%5 = load i8*, i8** %4
ret i8* %5
}

LLVM IR (-O2):
define i8* @f(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
%3 = load i8*, i8** %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int my_main(void) {
  printf("this is a program without main!\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"this is a program without main!\0A\00"
define i32 @my_main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [32 x i8] c"this is a program without main!\00"
define i32 @my_main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int heap_maximum(int *num) { return num[0]; }


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

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

LLVM IR (-O0):
define i32 @heap_maximum(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
ret i32 %5
}

LLVM IR (-O2):
define i32 @heap_maximum(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ microblaze_enable_exceptions();
int /*<<< orphan*/ microblaze_enable_interrupts();
void Xil_ExceptionEnable(void) {
  microblaze_enable_exceptions();
  microblaze_enable_interrupts();
}


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

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

LLVM IR (-O0):
define void @Xil_ExceptionEnable() {
%1 = call i32 (...) @microblaze_enable_exceptions()
%2 = call i32 (...) @microblaze_enable_interrupts()
ret void
}

LLVM IR (-O2):
define void @Xil_ExceptionEnable() {
%1 = tail call i32 (...) @microblaze_enable_exceptions()
%2 = tail call i32 (...) @microblaze_enable_interrupts()
ret void
}
/* Variables and functions */
int EINVAL;
int fail_invalid(int *cont) {
  if (cont) {
    *cont = 0;
  }
  return -EINVAL;
}


x86 assembly (clang, -O0):
<fail_invalid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     111d <fail_invalid+0x1d>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
xor    %eax,%eax
mov    0x2eba(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail_invalid>:
test   %rdi,%rdi
je     110b <fail_invalid+0xb>
movl   $0x0,(%rdi)
mov    0x2ece(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @fail_invalid(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32*, i32** %2
store i32 0, i32* %6
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* @EINVAL
%9 = sub nsw i32 0, %8
ret i32 %9
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @fail_invalid(i32* writeonly %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %4, label %3
3: ; preds = %1
store i32 0, i32* %0
br label %4
4: ; preds = %3, %1
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ print_double_test();
int /*<<< orphan*/ print_long_test();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  print_long_test();
  printf("\n");
  print_double_test();
  printf("\n");
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <print_long_test@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <print_double_test@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\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 (...) @print_long_test()
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @print_double_test()
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @print_long_test()
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (...) @print_double_test()
%6 = tail call i32 @putchar(i32 10)
ret i32 0
}
int isnum(c)
char c;
{ return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<isnum>:
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 <isnum+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):
<isnum>:
shl    $0x18,%edi
add    $0xd0ffffff,%edi
xor    %eax,%eax
cmp    $0xaffffff,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @isnum(i32 %0) {
%2 = shl i32 %0, 24
%3 = add i32 %2, -788529153
%4 = icmp ult i32 %3, 184549375
%5 = zext i1 %4 to i32
ret i32 %5
}
int ft_strcmp(const char *s1, const char *s2) {
  while (*s1 == *s2 && *s1) {
    ++s1;
    ++s2;
  }
  return ((unsigned char)*s1 - (unsigned char)*s2);
}


x86 assembly (clang, -O0):
<ft_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jne    1137 <ft_strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <ft_strcmp+0x47>
jmp    1164 <ft_strcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <ft_strcmp+0xc>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strcmp>:
mov    (%rdi),%al
mov    (%rsi),%cl
test   %al,%al
je     1134 <ft_strcmp+0x34>
cmp    %cl,%al
jne    1134 <ft_strcmp+0x34>
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
test   %al,%al
je     1134 <ft_strcmp+0x34>
add    $0x1,%rdx
cmp    %cl,%al
je     1120 <ft_strcmp+0x20>
movzbl %al,%eax
movzbl %cl,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp ne i8 %3, %4
%6 = icmp eq i8 %3, 0
%7 = or i1 %6, %5
br i1 %7, label %18, label %8
8: ; preds = %2, %8
%9 = phi i8* [ %12, %8 ], [ %1, %2 ]
%10 = phi i8* [ %11, %8 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %11
%14 = load i8, i8* %12
%15 = icmp ne i8 %13, %14
%16 = icmp eq i8 %13, 0
%17 = or i1 %16, %15
br i1 %17, label %18, label %8
18: ; preds = %8, %2
%19 = phi i8 [ %3, %2 ], [ %13, %8 ]
%20 = phi i8 [ %4, %2 ], [ %14, %8 ]
%21 = zext i8 %19 to i32
%22 = zext i8 %20 to i32
%23 = sub nsw i32 %21, %22
ret i32 %23
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
void logout() {
  extern int servfd;
  extern char connected_gl;
  char str[6] = "/exit";
  send(servfd, str, 6, 0);
  close(servfd);
  connected_gl = 0;
}


x86 assembly (clang, -O0):
<logout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0x2(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    -0x6(%rbp),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <close@plt>
mov    0x2e6e(%rip),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logout>:
push   %rbx
sub    $0x10,%rsp
movw   $0x74,0xc(%rsp)
movl   $0x6978652f,0x8(%rsp)
69
mov    0x2ead(%rip),%rbx
mov    (%rbx),%edi
lea    0x8(%rsp),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    (%rbx),%edi
call   1040 <close@plt>
mov    0x2e7c(%rip),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.logout.str = [6 x i8] c"/exit\00"
@servfd = external global i32
@connected_gl = external global i8
define void @logout() {
%1 = alloca [6 x i8]
%2 = bitcast [6 x i8]* %1 to i8*
%3 = load i32, i32* @servfd
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%5 = call i32 @send(i32 %3, i8* %4, i32 6, i32 0)
%6 = load i32, i32* @servfd
%7 = call i32 @close(i32 %6)
store i8 0, i8* @connected_gl
ret void
}

LLVM IR (-O2):
@__const.logout.str = [6 x i8] c"/exit\00"
@servfd = external global i32
@connected_gl = external global i8
define void @logout() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @servfd
%4 = call i32 @send(i32 %3, i8* %2, i32 6, i32 0)
%5 = load i32, i32* @servfd
%6 = call i32 @close(i32 %5)
store i8 0, i8* @connected_gl
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello, ");
  printf("world");
  printf("\n");
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"hello, \00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"hello, \00"
@.str.1 = [6 x i8] c"world\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ memcmp;

/* Variables and functions */
void *(memends)(const void *string, size_t string_size, const void *desired,
                size_t desired_size) {
  return (memcmp)(string + (string_size - desired_size), desired, desired_size)
             ? NULL
             : (string + string_size);
}


x86 assembly (clang, -O0):
<memends>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     112a <memends+0x2a>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1136 <memends+0x36>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memends>:
lea    (%rdi,%rsi,1),%rdx
xor    %eax,%eax
test   %rcx,%rcx
cmove  %rdx,%rax
ret

LLVM IR (-O0):
define i8* @memends(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %8
%12 = sub i64 %10, %11
%13 = getelementptr i8, i8* %9, i64 %12
%14 = load i8*, i8** %7
%15 = load i64, i64* %8
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %4
br label %22
18: ; preds = %4
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = getelementptr i8, i8* %19, i64 %20
br label %22
22: ; preds = %18, %17
%23 = phi i8* [ null, %17 ], [ %21, %18 ]
ret i8* %23
}

LLVM IR (-O2):
define i8* @memends(i8* readnone %0, i64 %1, i8* nocapture readnone %2, i64 %3) {
%5 = icmp eq i64 %3, 0
%6 = getelementptr i8, i8* %0, i64 %1
%7 = select i1 %5, i8* %6, i8* null
ret i8* %7
}
void *q(void *d) {
  char *s;
  asprintf(&s, "<%s>", (char *)d);
  return s;
}


x86 assembly (clang, -O0):
<q>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1030 <asprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"<%s>\00"
define i8* @q(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8**, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, ...)*)(i8** %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
@.str = [5 x i8] c"<%s>\00"
define i8* @q(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 (i8**, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, ...)*)(i8** %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i8*, i8** %2
ret i8* %5
}
char *get_dropbox_api_key() { return "key\0"; }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"key\00\00"
define i8* @get_dropbox_api_key() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"key\00\00"
define i8* @get_dropbox_api_key() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ CFG_SetConfigString(char const *, char const *);
void CFG_SetConfigEnum(const char *name, const char **strings, int value) {
  CFG_SetConfigString(name, strings[value]);
}


x86 assembly (clang, -O0):
<CFG_SetConfigEnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <CFG_SetConfigString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CFG_SetConfigEnum>:
movslq %edx,%rax
mov    (%rsi,%rax,8),%rsi
jmp    1030 <CFG_SetConfigString@plt>

LLVM IR (-O0):
define void @CFG_SetConfigEnum(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @CFG_SetConfigString(i8* %7, i8* %12)
ret void
}

LLVM IR (-O2):
define void @CFG_SetConfigEnum(i8* %0, i8** nocapture %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8*, i8** %1, i64 %4
%6 = load i8*, i8** %5
%7 = tail call i32 @CFG_SetConfigString(i8* %0, i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_ip4_addr();
int /*<<< orphan*/ test_ip6_addr();
int main(void) {
  test_ip4_addr();
  test_ip6_addr();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_ip4_addr@plt>
xor    %eax,%eax
call   1040 <test_ip6_addr@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_ip4_addr()
%2 = tail call i32 (...) @test_ip6_addr()
ret i32 0
}
void clear_bit(unsigned char *ptr, int bit) {
  int byte_num = bit / 8;
  int bit_num = bit % 8;
  ptr[byte_num] &= ~(1 << bit_num);
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
xor    $0xffffffff,%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
and    %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
mov    %esi,%ecx
lea    0x7(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x3,%eax
and    $0x7,%cl
mov    $0x1,%edx
shl    %cl,%edx
cltq
not    %dl
and    %dl,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @clear_bit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 8
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = srem i32 %9, 8
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = shl i32 1, %11
%13 = xor i32 %12, -1
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = and i32 %19, %13
%21 = trunc i32 %20 to i8
store i8 %21, i8* %17
ret void
}

LLVM IR (-O2):
define void @clear_bit(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = and i32 %1, 7
%5 = shl nuw nsw i32 1, %4
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = trunc i32 %5 to i8
%10 = xor i8 %9, -1
%11 = and i8 %8, %10
store i8 %11, i8* %7
ret void
}
/* Variables and functions */
int errno;
void shl_set_errno(int *r) { errno = *r; }


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

x86 assembly (clang, -O2):
<shl_set_errno>:
mov    (%rdi),%eax
mov    0x2ed7(%rip),%rcx
mov    %eax,(%rcx)
ret

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

LLVM IR (-O2):
@errno = global i32 0
define void @shl_set_errno(i32* nocapture %0) {
%2 = load i32, i32* %0
store i32 %2, i32* @errno
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ do_pthread_cond_wait(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/);
int pthread_cond_wait_nocheck(pthread_cond_t *cond, pthread_mutex_t *mutex) {
  do_pthread_cond_wait(cond, mutex, 0);
  return 0;
}


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

x86 assembly (clang, -O2):
<pthread_cond_wait_nocheck>:
push   %rax
xor    %edx,%edx
call   1030 <do_pthread_cond_wait@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pthread_cond_wait_nocheck(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 = call i32 @do_pthread_cond_wait(i32* %5, i32* %6, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_cond_wait_nocheck(i32* %0, i32* %1) {
%3 = tail call i32 @do_pthread_cond_wait(i32* %0, i32* %1, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ display();
int insert_mode();
int /*<<< orphan*/ lnbegin();
int insert_before(void) {
  lnbegin();
  display();
  return insert_mode();
}


x86 assembly (clang, -O0):
<insert_before>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <lnbegin@plt>
mov    $0x0,%al
call   1030 <display@plt>
mov    $0x0,%al
call   1040 <insert_mode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_before>:
push   %rax
xor    %eax,%eax
call   1050 <lnbegin@plt>
xor    %eax,%eax
call   1030 <display@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <insert_mode@plt>

LLVM IR (-O0):
define i32 @insert_before() {
%1 = call i32 (...) @lnbegin()
%2 = call i32 (...) @display()
%3 = call i32 (...) @insert_mode()
ret i32 %3
}

LLVM IR (-O2):
define i32 @insert_before() {
%1 = tail call i32 (...) @lnbegin()
%2 = tail call i32 (...) @display()
%3 = tail call i32 (...) @insert_mode()
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ****dirent;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ ******);
void mydir_close(struct dirent **name_list, size_t nb_name) {
  int i;
  for (i = 0; i < nb_name; i++)
    free(name_list[i]);
  free(name_list);
}


x86 assembly (clang, -O0):
<mydir_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1154 <mydir_close+0x44>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <mydir_close+0x17>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mydir_close>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rsi,%rsi
je     1142 <mydir_close+0x32>
mov    %rsi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <mydir_close+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.dirent = type opaque
define void @mydir_close(%struct.dirent** %0, i64 %1) {
%3 = alloca %struct.dirent**
%4 = alloca i64
%5 = alloca i32
store %struct.dirent** %0, %struct.dirent*** %3
store i64 %1, i64* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = sext i32 %7 to i64
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = load %struct.dirent**, %struct.dirent*** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds %struct.dirent*, %struct.dirent** %12, i64 %14
%16 = load %struct.dirent*, %struct.dirent** %15
%17 = bitcast %struct.dirent* %16 to i32******
%18 = call i32 @free(i32****** %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
%23 = load %struct.dirent**, %struct.dirent*** %3
%24 = bitcast %struct.dirent** %23 to i32******
%25 = call i32 @free(i32****** %24)
ret void
}

LLVM IR (-O2):
%struct.dirent = type opaque
define void @mydir_close(%struct.dirent** nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds %struct.dirent*, %struct.dirent** %0, i64 %5
%7 = bitcast %struct.dirent** %6 to i32*******
%8 = load i32******, i32******* %7
%9 = tail call i32 @free(i32****** %8)
%10 = add nuw nsw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = bitcast %struct.dirent** %0 to i32******
%14 = tail call i32 @free(i32****** %13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ x();
int /*<<< orphan*/ y();
int main() {
  x();
  a();
  y();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <x@plt>
mov    $0x0,%al
call   1040 <a@plt>
mov    $0x0,%al
call   1050 <y@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <x@plt>
xor    %eax,%eax
call   1040 <a@plt>
xor    %eax,%eax
call   1050 <y@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @x()
%2 = call i32 (...) @a()
%3 = call i32 (...) @y()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @x()
%2 = tail call i32 (...) @a()
%3 = tail call i32 (...) @y()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t;

/* Variables and functions */
int ioinfo(const char *path, int fd, u_int32_t *mbytesp, u_int32_t *bytesp,
           u_int32_t *iosizep) {
  return (0);
}


x86 assembly (clang, -O0):
<ioinfo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ioinfo(i8* nocapture readnone %0, i32 %1, i32* nocapture readnone %2, i32* nocapture readnone %3, i32* nocapture readnone %4) {
ret i32 0
}
/* Type definitions */
struct rlimit {
  int /*<<< orphan*/ rlim_max;
  int /*<<< orphan*/ rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ getrlimit(int, struct rlimit *);
int /*<<< orphan*/ padd(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void dump(char *header, int resource) {
  struct rlimit limit;
  getrlimit(resource, &limit);
  printf(header);
  padd(limit.rlim_cur);
  padd(limit.rlim_max);
  printf("\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1050 <getrlimit@plt>
mov    -0x8(%rbp),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <padd@plt>
mov    -0x18(%rbp),%edi
call   1040 <padd@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%eax
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1060 <getrlimit@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%edi
call   1050 <padd@plt>
mov    0x8(%rsp),%edi
call   1050 <padd@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@.str = [2 x i8] c"\0A\00"
define void @dump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.rlimit
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @getrlimit(i32 %6, %struct.rlimit* %5)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* %8)
%10 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %5, i32 0, i32 1
%11 = load i32, i32* %10
%12 = call i32 @padd(i32 %11)
%13 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %5, i32 0, i32 0
%14 = load i32, i32* %13
%15 = call i32 @padd(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
define void @dump(i8* nocapture %0, i32 %1) {
%3 = alloca %struct.rlimit
%4 = bitcast %struct.rlimit* %3 to i8*
%5 = call i32 @getrlimit(i32 %1, %struct.rlimit* %3)
%6 = call i32 @printf(i8* dereferenceable(1) %0)
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 1
%8 = load i32, i32* %7
%9 = call i32 @padd(i32 %8)
%10 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @padd(i32 %11)
%13 = call i32 @putchar(i32 10)
ret void
}
void rdri_(dx, dy, dz) int *dx, *dy, *dz;
{ rdr((float)*dx, (float)*dy, (float)*dz); }


x86 assembly (clang, -O0):
<rdri_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2ssl (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2ssl (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x18(%rbp),%rax
cvtsi2ssl (%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mov    $0x3,%al
call   1030 <rdr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdri_>:
cvtsi2ssl (%rdi),%xmm0
cvtsi2ssl (%rsi),%xmm1
cvtsi2ssl (%rdx),%xmm2
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
mov    $0x3,%al
jmp    1030 <rdr@plt>

LLVM IR (-O0):
define void @rdri_(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to float
%10 = fpext float %9 to double
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to float
%14 = fpext float %13 to double
%15 = load i32*, i32** %6
%16 = load i32, i32* %15
%17 = sitofp i32 %16 to float
%18 = fpext float %17 to double
%19 = call i32 (double, double, double, ...) bitcast (i32 (...)* @rdr to i32 (double, double, double, ...)*)(double %10, double %14, double %18)
ret void
}

LLVM IR (-O2):
define void @rdri_(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = sitofp i32 %4 to float
%6 = fpext float %5 to double
%7 = load i32, i32* %1
%8 = sitofp i32 %7 to float
%9 = fpext float %8 to double
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to float
%12 = fpext float %11 to double
%13 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @rdr to i32 (double, double, double, ...)*)(double %6, double %9, double %12)
ret void
}
const char *config_fomu_rev_read(void) { return "HACKER"; }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"HACKER\00"
define i8* @config_fomu_rev_read() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"HACKER\00"
define i8* @config_fomu_rev_read() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}