xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void *helloThread(void *threadid) {
  sleep(1);
  printf("Thread %d: Hello World!\n", (int)(uintptr_t)threadid);
  return (NULL);
}


x86 assembly (clang, -O0):
<helloThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helloThread>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xecb(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Thread %d: Hello World!\0A\00"
define i8* @helloThread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 1)
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = trunc i64 %5 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i8* null
}

LLVM IR (-O2):
@.str = [25 x i8] c"Thread %d: Hello World!\0A\00"
define noalias i8* @helloThread(i8* %0) {
%2 = tail call i32 @sleep(i32 1)
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i8* null
}
__float128 f128_mul(__float128 a, __float128 b) { return a * b; }


x86 assembly (clang, -O0):
<f128_mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movaps %xmm0,-0x10(%rbp)
movaps %xmm1,-0x20(%rbp)
movaps -0x10(%rbp),%xmm0
movaps -0x20(%rbp),%xmm1
call   1130 <__multf3>
add    $0x20,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

x86 assembly (clang, -O2):
<f128_mul>:
jmp    1110 <__multf3>
cs nopw 0x0(%rax,%rax,1)
nop

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

LLVM IR (-O2):
define fp128 @f128_mul(fp128 %0, fp128 %1) {
%3 = fmul fp128 %0, %1
ret fp128 %3
}
/* Variables and functions */
int /*<<< orphan*/ VMove(int, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *);
help() {
  VMove(3, 0);
  printw("\tHelp или Справка - краткая справка по командам\n\n\r");
  printw("\n\t*\t- шаг\n\r");
  printw("\n\t/\t- переключение цветовой палитры\n\r");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
xor    %esi,%esi
call   1040 <VMove@plt>
lea    0xec5(%rip),%rdi
call   1030 <printw@plt>
lea    0xf0e(%rip),%rdi
call   1030 <printw@plt>
lea    0xf11(%rip),%rdi
call   1030 <printw@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
mov    $0x3,%edi
xor    %esi,%esi
call   1040 <VMove@plt>
lea    0xecc(%rip),%rdi
call   1030 <printw@plt>
lea    0xf15(%rip),%rdi
call   1030 <printw@plt>
lea    0xf18(%rip),%rdi
pop    %rax
jmp    1030 <printw@plt>

LLVM IR (-O0):
@.str = [85 x i8] c"\09Help \D0\B8\D0\BB\D0\B8 \D0\A1\D0\BF\D1\80\D0\B0\D0\B2\D0\BA\D0\B0 - \D0\BA\D1\80\D0\B0\D1\82\D0\BA\D0\B0\D1\8F \D1\81\D0\BF\D1\80\D0\B0\D0\B2\D0\BA\D0\B0 \D0\BF\D0\BE \D0\BA\D0\BE\D0\BC\D0\B0\D0\BD\D0\B4\D0\B0\D0\BC\0A\0A\0D\00"
@.str.1 = [15 x i8] c"\0A\09*\09- \D1\88\D0\B0\D0\B3\0A\0D\00"
@.str.2 = [65 x i8] c"\0A\09/\09- \D0\BF\D0\B5\D1\80\D0\B5\D0\BA\D0\BB\D1\8E\D1\87\D0\B5\D0\BD\D0\B8\D0\B5 \D1\86\D0\B2\D0\B5\D1\82\D0\BE\D0\B2\D0\BE\D0\B9 \D0\BF\D0\B0\D0\BB\D0\B8\D1\82\D1\80\D1\8B\0A\0D\00"
define i32 @help() {
%1 = alloca i32
%2 = call i32 @VMove(i32 3, i32 0)
%3 = call i32 @printw(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printw(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printw(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@.str = [85 x i8] c"\09Help \D0\B8\D0\BB\D0\B8 \D0\A1\D0\BF\D1\80\D0\B0\D0\B2\D0\BA\D0\B0 - \D0\BA\D1\80\D0\B0\D1\82\D0\BA\D0\B0\D1\8F \D1\81\D0\BF\D1\80\D0\B0\D0\B2\D0\BA\D0\B0 \D0\BF\D0\BE \D0\BA\D0\BE\D0\BC\D0\B0\D0\BD\D0\B4\D0\B0\D0\BC\0A\0A\0D\00"
@.str.1 = [15 x i8] c"\0A\09*\09- \D1\88\D0\B0\D0\B3\0A\0D\00"
@.str.2 = [65 x i8] c"\0A\09/\09- \D0\BF\D0\B5\D1\80\D0\B5\D0\BA\D0\BB\D1\8E\D1\87\D0\B5\D0\BD\D0\B8\D0\B5 \D1\86\D0\B2\D0\B5\D1\82\D0\BE\D0\B2\D0\BE\D0\B9 \D0\BF\D0\B0\D0\BB\D0\B8\D1\82\D1\80\D1\8B\0A\0D\00"
define i32 @help() {
%1 = tail call i32 @VMove(i32 3, i32 0)
%2 = tail call i32 @printw(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printw(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printw(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
char *realloc(char *, int);
int /*<<< orphan*/ strcat(char *, char const *);
int strlen(char const *);
void concat(char **dst, const char *src) {
  int dst_len = strlen(*dst);
  int src_len = strlen(src);
  *dst = realloc(*dst, src_len + dst_len + 1);
  strcat(*dst, src);
}


x86 assembly (clang, -O0):
<concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%esi
add    -0x14(%rbp),%esi
add    $0x1,%esi
call   1040 <realloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    (%rbx),%rdi
lea    (%r15,%rax,1),%esi
add    $0x1,%esi
call   1040 <realloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <strcat@plt>

LLVM IR (-O0):
define void @concat(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %3
store i8* %1, i8** %4
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %6
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %12
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = add nsw i32 %14, %15
%17 = add nsw i32 %16, 1
%18 = call i8* @realloc(i8* %13, i32 %17)
%19 = load i8**, i8*** %3
store i8* %18, i8** %19
%20 = load i8**, i8*** %3
%21 = load i8*, i8** %20
%22 = load i8*, i8** %4
%23 = call i32 @strcat(i8* %21, i8* %22)
ret void
}

LLVM IR (-O2):
define void @concat(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strlen(i8* %3)
%5 = tail call i32 @strlen(i8* %1)
%6 = load i8*, i8** %0
%7 = add i32 %4, 1
%8 = add i32 %7, %5
%9 = tail call i8* @realloc(i8* %6, i32 %8)
store i8* %9, i8** %0
%10 = tail call i32 @strcat(i8* %9, i8* %1)
ret void
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *read_str(const char *beg, size_t len) {
  char *p = malloc(len + 1);
  memcpy(p, beg, len);
  p[len] = '\0';
  return p;
}


x86 assembly (clang, -O0):
<read_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_str>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @read_str(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%6 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %6
ret i8* %4
}
int test_imm_F1int8_mem(signed char *val) {
  return ((*val) & (0xF1 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_F1int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -15
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct compilation_unit {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void disassemble(struct compilation_unit *cu, void *start, void *end) {
  assert(!"not implemented");
}


x86 assembly (clang, -O0):
<disassemble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disassemble>:
xor    %edi,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct.compilation_unit = type { i32 }
@.str = [16 x i8] c"not implemented\00"
define void @disassemble(%struct.compilation_unit* %0, i8* %1, i8* %2) {
%4 = alloca %struct.compilation_unit*
%5 = alloca i8*
%6 = alloca i8*
store %struct.compilation_unit* %0, %struct.compilation_unit** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = call i32 @assert(i32 0)
ret void
}

LLVM IR (-O2):
%struct.compilation_unit = type { i32 }
define void @disassemble(%struct.compilation_unit* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @assert(i32 0)
ret void
}
/* Type definitions */
typedef char *uint64_t;
typedef char *int64_t;

/* Variables and functions */
int64_t syscall2(uint64_t msg, uint64_t arg1, uint64_t arg2) {
  __asm__ __volatile__("syscall"
                       : "=a"(msg), "=D"(arg1), "=S"(arg2)
                       : "a"(msg), "D"(arg1), "S"(arg2)
                       : "%rdx", "r8", "r9", "r10", "r11", "%rcx", "memory");
  return msg;
}


x86 assembly (clang, -O0):
<syscall2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
syscall
mov    %rax,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall2>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
syscall
ret

LLVM IR (-O0):
define i8* @syscall2(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 = load i8*, i8** %6
%10 = call { i8*, i8*, i8* } asm sideeffect "syscall", "={ax},={di},={si},{ax},{di},{si},~{rdx},~{r8},~{r9},~{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %7, i8* %8, i8* %9)
%11 = extractvalue { i8*, i8*, i8* } %10, 0
%12 = extractvalue { i8*, i8*, i8* } %10, 1
%13 = extractvalue { i8*, i8*, i8* } %10, 2
store i8* %11, i8** %4
store i8* %12, i8** %5
store i8* %13, i8** %6
%14 = load i8*, i8** %4
ret i8* %14
}

LLVM IR (-O2):
define i8* @syscall2(i8* %0, i8* %1, i8* %2) {
%4 = tail call { i8*, i8*, i8* } asm sideeffect "syscall", "={ax},={di},={si},{ax},{di},{si},~{rdx},~{r8},~{r9},~{r10},~{r11},~{rcx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1, i8* %2)
%5 = extractvalue { i8*, i8*, i8* } %4, 0
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void usage(FILE *file, const char *arg0) {
  fprintf(file,
          "Usage: %s [options] [directory] ...\n"
          "Options:\n"
          "  -h  Print this message\n"
          "  -V  Print version\n",
          arg0);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [91 x i8] c"Usage: %s [options] [directory] ...\0AOptions:\0A -h Print this message\0A -V Print version\0A\00"
define void @usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [91 x i8] c"Usage: %s [options] [directory] ...\0AOptions:\0A -h Print this message\0A -V Print version\0A\00"
define void @usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
char fun_call_ret_2() { return 120; }


x86 assembly (clang, -O0):
<fun_call_ret_2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x78,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_call_ret_2>:
mov    $0x78,%al
ret

LLVM IR (-O0):
define signext i8 @fun_call_ret_2() {
ret i8 120
}

LLVM IR (-O2):
define signext i8 @fun_call_ret_2() {
ret i8 120
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ scanf(char *, char **);
long strtol(char *, int /*<<< orphan*/, int);
int main() {
  char *value_tri = 0;
  scanf("%ms", &value_tri);
  long value = strtol(value_tri, 0, 3);
  printf("%ld\n", value);
  free(value_tri);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xea2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1050 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
lea    0xeb0(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1050 <strtol@plt>
lea    0xe95(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ms\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1)
%4 = load i8*, i8** %1
%5 = call i64 @strtol(i8* %4, i32 0, i32 3)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %5)
%7 = load i8*, i8** %1
%8 = call i32 @free(i8* %7)
ret i32 0
}
/* Variables and functions */
void *ft_memalloc(size_t);
void *ft_memcpy(void *, void *, size_t);
int /*<<< orphan*/ ft_memdel(void **);
void *ft_memmove(void *dest, const void *src, size_t n) {
  void *tmp;
  tmp = ft_memalloc(n);
  tmp = ft_memcpy(tmp, src, n);
  dest = ft_memcpy(dest, tmp, n);
  ft_memdel(&tmp);
  return (dest);
}


x86 assembly (clang, -O0):
<ft_memmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <ft_memalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <ft_memcpy@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <ft_memcpy@plt>
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <ft_memdel@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_memmove>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1050 <ft_memalloc@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <ft_memcpy@plt>
mov    %rax,0x8(%rsp)
mov    %r15,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1040 <ft_memcpy@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
call   1030 <ft_memdel@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @ft_memmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = call i8* @ft_memalloc(i64 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = call i8* @ft_memcpy(i8* %10, i8* %11, i64 %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %4
%15 = load i8*, i8** %7
%16 = load i64, i64* %6
%17 = call i8* @ft_memcpy(i8* %14, i8* %15, i64 %16)
store i8* %17, i8** %4
%18 = call i32 @ft_memdel(i8** %7)
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
define i8* @ft_memmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = tail call i8* @ft_memalloc(i64 %2)
%7 = tail call i8* @ft_memcpy(i8* %6, i8* %1, i64 %2)
store i8* %7, i8** %4
%8 = tail call i8* @ft_memcpy(i8* %0, i8* %7, i64 %2)
%9 = call i32 @ft_memdel(i8** %4)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ test_MOVBE_MtoR_16();
int /*<<< orphan*/ test_MOVBE_MtoR_32();
int /*<<< orphan*/ test_MOVBE_MtoR_64();
int /*<<< orphan*/ test_MOVBE_RtoM_16();
int /*<<< orphan*/ test_MOVBE_RtoM_32();
int /*<<< orphan*/ test_MOVBE_RtoM_64();
int main(void) {
  test_MOVBE_RtoM_64();
  test_MOVBE_RtoM_32();
  test_MOVBE_RtoM_16();
  test_MOVBE_MtoR_64();
  test_MOVBE_MtoR_32();
  test_MOVBE_MtoR_16();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <test_MOVBE_RtoM_64@plt>
mov    $0x0,%al
call   1040 <test_MOVBE_RtoM_32@plt>
mov    $0x0,%al
call   1030 <test_MOVBE_RtoM_16@plt>
mov    $0x0,%al
call   1050 <test_MOVBE_MtoR_64@plt>
mov    $0x0,%al
call   1060 <test_MOVBE_MtoR_32@plt>
mov    $0x0,%al
call   1080 <test_MOVBE_MtoR_16@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <test_MOVBE_RtoM_64@plt>
xor    %eax,%eax
call   1040 <test_MOVBE_RtoM_32@plt>
xor    %eax,%eax
call   1030 <test_MOVBE_RtoM_16@plt>
xor    %eax,%eax
call   1050 <test_MOVBE_MtoR_64@plt>
xor    %eax,%eax
call   1060 <test_MOVBE_MtoR_32@plt>
xor    %eax,%eax
call   1080 <test_MOVBE_MtoR_16@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_MOVBE_RtoM_64()
%3 = call i32 (...) @test_MOVBE_RtoM_32()
%4 = call i32 (...) @test_MOVBE_RtoM_16()
%5 = call i32 (...) @test_MOVBE_MtoR_64()
%6 = call i32 (...) @test_MOVBE_MtoR_32()
%7 = call i32 (...) @test_MOVBE_MtoR_16()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_MOVBE_RtoM_64()
%2 = tail call i32 (...) @test_MOVBE_RtoM_32()
%3 = tail call i32 (...) @test_MOVBE_RtoM_16()
%4 = tail call i32 (...) @test_MOVBE_MtoR_64()
%5 = tail call i32 (...) @test_MOVBE_MtoR_32()
%6 = tail call i32 (...) @test_MOVBE_MtoR_16()
ret i32 0
}
/* Variables and functions */
int db_sql_exec_fn(char **, int, char *);
int db_sql_force_rescan(char **pe) {
  int result;
  result = db_sql_exec_fn(pe, 1, "update playlists set db_timestamp=0");
  if (result != 0x00)
    return result;
  return db_sql_exec_fn(pe, 1, "update songs set force_update=1");
}


x86 assembly (clang, -O0):
<db_sql_force_rescan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
lea    0xed4(%rip),%rdx
call   1030 <db_sql_exec_fn@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1149 <db_sql_force_rescan+0x39>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <db_sql_force_rescan+0x51>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
lea    0xecb(%rip),%rdx
call   1030 <db_sql_exec_fn@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_sql_force_rescan>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdx
mov    $0x1,%esi
call   1030 <db_sql_exec_fn@plt>
test   %eax,%eax
je     112b <db_sql_force_rescan+0x1b>
pop    %rbx
ret
lea    0xef2(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <db_sql_exec_fn@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"update playlists set db_timestamp=0\00"
@.str.1 = [32 x i8] c"update songs set force_update=1\00"
define i32 @db_sql_force_rescan(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = call i32 @db_sql_exec_fn(i8** %5, i32 1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %14
11: ; preds = %1
%12 = load i8**, i8*** %3
%13 = call i32 @db_sql_exec_fn(i8** %12, i32 1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [36 x i8] c"update playlists set db_timestamp=0\00"
@.str.1 = [32 x i8] c"update songs set force_update=1\00"
define i32 @db_sql_force_rescan(i8** %0) {
%2 = tail call i32 @db_sql_exec_fn(i8** %0, i32 1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @db_sql_exec_fn(i8** %0, i32 1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Type definitions */
struct tss_struct {
  int dummy;
};
struct thread_struct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ native_load_sp0(struct tss_struct *, struct thread_struct *);
__attribute__((always_)) void load_sp0(struct tss_struct *tss,
                                       struct thread_struct *thread) {
  native_load_sp0(tss, thread);
}


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

x86 assembly (clang, -O2):
<load_sp0>:
jmp    1030 <native_load_sp0@plt>

LLVM IR (-O0):
%struct.tss_struct = type { i32 }
%struct.thread_struct = type { i32 }
define void @load_sp0(%struct.tss_struct* %0, %struct.thread_struct* %1) {
%3 = alloca %struct.tss_struct*
%4 = alloca %struct.thread_struct*
store %struct.tss_struct* %0, %struct.tss_struct** %3
store %struct.thread_struct* %1, %struct.thread_struct** %4
%5 = load %struct.tss_struct*, %struct.tss_struct** %3
%6 = load %struct.thread_struct*, %struct.thread_struct** %4
%7 = call i32 @native_load_sp0(%struct.tss_struct* %5, %struct.thread_struct* %6)
ret void
}

LLVM IR (-O2):
%struct.tss_struct = type { i32 }
%struct.thread_struct = type { i32 }
define void @load_sp0(%struct.tss_struct* %0, %struct.thread_struct* %1) {
%3 = tail call i32 @native_load_sp0(%struct.tss_struct* %0, %struct.thread_struct* %1)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
char *x_strdup(char const *);
char *str_basename(const char *s) {
  char *p = strrchr(s, '/');
  if (p) {
    return x_strdup(p + 1);
  }
  return x_strdup(s);
}


x86 assembly (clang, -O0):
<str_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115f <str_basename+0x3f>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1040 <x_strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    116c <str_basename+0x4c>
mov    -0x10(%rbp),%rdi
call   1040 <x_strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1140 <str_basename+0x20>
add    $0x1,%rax
mov    %rax,%rdi
pop    %rbx
jmp    1040 <x_strdup@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <x_strdup@plt>

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

LLVM IR (-O2):
define i8* @str_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = tail call i8* @x_strdup(i8* %5)
br label %9
7: ; preds = %1
%8 = tail call i8* @x_strdup(i8* %0)
br label %9
9: ; preds = %7, %4
%10 = phi i8* [ %6, %4 ], [ %8, %7 ]
ret i8* %10
}
/* Type definitions */
struct t_hashtable {
  int dummy;
};
struct t_gui_color_palette {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gui_color_palette_free(struct t_gui_color_palette *);
void gui_color_palette_free_value_cb(struct t_hashtable *hashtable,
                                     const void *key, void *value) {
  struct t_gui_color_palette *color_palette;
  (void)hashtable;
  (void)key;
  color_palette = (struct t_gui_color_palette *)value;
  if (color_palette)
    gui_color_palette_free(color_palette);
}


x86 assembly (clang, -O0):
<gui_color_palette_free_value_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1140 <gui_color_palette_free_value_cb+0x30>
mov    -0x20(%rbp),%rdi
call   1030 <gui_color_palette_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_color_palette_free_value_cb>:
test   %rdx,%rdx
je     111d <gui_color_palette_free_value_cb+0xd>
mov    %rdx,%rdi
jmp    1030 <gui_color_palette_free@plt>
ret

LLVM IR (-O0):
%struct.t_hashtable = type { i32 }
%struct.t_gui_color_palette = type { i32 }
define void @gui_color_palette_free_value_cb(%struct.t_hashtable* %0, i8* %1, i8* %2) {
%4 = alloca %struct.t_hashtable*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.t_gui_color_palette*
store %struct.t_hashtable* %0, %struct.t_hashtable** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load %struct.t_hashtable*, %struct.t_hashtable** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = bitcast i8* %10 to %struct.t_gui_color_palette*
store %struct.t_gui_color_palette* %11, %struct.t_gui_color_palette** %7
%12 = load %struct.t_gui_color_palette*, %struct.t_gui_color_palette** %7
%13 = icmp ne %struct.t_gui_color_palette* %12, null
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load %struct.t_gui_color_palette*, %struct.t_gui_color_palette** %7
%16 = call i32 @gui_color_palette_free(%struct.t_gui_color_palette* %15)
br label %17
17: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
%struct.t_hashtable = type { i32 }
%struct.t_gui_color_palette = type { i32 }
define void @gui_color_palette_free_value_cb(%struct.t_hashtable* nocapture readnone %0, i8* nocapture readnone %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = bitcast i8* %2 to %struct.t_gui_color_palette*
%7 = tail call i32 @gui_color_palette_free(%struct.t_gui_color_palette* %6)
br label %8
8: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int);
void merge_sort(int *A, int size) {
  int m;
  if (size < 2)
    return;
  m = size / 2;
  merge_sort(A, m);
  merge_sort(A + m, size - m);
  merge(A, size, m);
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    113e <merge_sort+0x1e>
jmp    1181 <merge_sort+0x61>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    $0x1,%esi
jg     1126 <merge_sort+0x6>
ret
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1040 <merge_sort@plt>
lea    (%r14,%rbx,4),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
call   1040 <merge_sort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <merge@plt>

LLVM IR (-O0):
define void @merge_sort(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 = icmp slt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
br label %25
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 2
store i32 %11, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = load i32*, i32** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @merge(i32* %21, i32 %22, i32 %23)
br label %25
25: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = lshr i32 %1, 1
tail call void @merge_sort(i32* %0, i32 %6)
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = sub nsw i32 %1, %6
tail call void @merge_sort(i32* %8, i32 %9)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %6)
br label %4
}
unsigned h2(void) {
  static unsigned x;
  return x;
}


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

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

LLVM IR (-O0):
@h2.x = internal global i32 0
define i32 @h2() {
%1 = load i32, i32* @h2.x
ret i32 %1
}

LLVM IR (-O2):
define i32 @h2() {
ret i32 0
}
/* Variables and functions */
int htonl(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  if (htonl(1024) == 1024) {
    printf("host is Big Endian\n");
  } else {
    printf("host if Little Endian\n");
  };
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x400,%edi
call   1040 <htonl@plt>
cmp    $0x400,%eax
jne    1155 <main+0x35>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    1161 <main+0x41>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x400,%edi
call   1040 <htonl@plt>
cmp    $0x400,%eax
lea    0xedf(%rip),%rax
lea    0xec2(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"host is Big Endian\0A\00"
@.str.1 = [23 x i8] c"host if Little Endian\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @htonl(i32 1024)
%3 = icmp eq i32 %2, 1024
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"host if Little Endian\00"
@str.2 = [19 x i8] c"host is Big Endian\00"
define i32 @main() {
%1 = tail call i32 @htonl(i32 1024)
%2 = icmp eq i32 %1, 1024
%3 = select i1 %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 0
}
void _strcat(char *s, const char *t) {
  while (*s)
    s++;
  while (*t)
    *s++ = *t++;
  *s = '\0';
}


x86 assembly (clang, -O0):
<_strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     112a <_strcat+0x2a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <_strcat+0xc>
jmp    112f <_strcat+0x2f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <_strcat+0x63>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    112f <_strcat+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strcat>:
mov    %rdi,%rcx
add    $0x1,%rdi
cmpb   $0x0,(%rcx)
jne    1100 <_strcat>
mov    (%rsi),%al
test   %al,%al
je     1136 <_strcat+0x36>
mov    $0xffffffffffffffff,%rcx
nopl   0x0(%rax)
mov    %al,(%rdi,%rcx,1)
movzbl 0x2(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1120 <_strcat+0x20>
add    %rcx,%rdi
mov    %rdi,%rcx
movb   $0x0,(%rcx)
ret

LLVM IR (-O0):
define void @_strcat(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 = %9, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
br label %5
12: ; preds = %5
br label %13
13: ; preds = %17, %12
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
%20 = load i8, i8* %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
store i8 %20, i8* %21
br label %13
23: ; preds = %13
%24 = load i8*, i8** %3
store i8 0, i8* %24
ret void
}

LLVM IR (-O2):
define void @_strcat(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %15, %11 ], [ %1, %8 ]
%14 = phi i8* [ %16, %11 ], [ %4, %8 ]
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %12, i8* %14
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
%20 = phi i8* [ %4, %8 ], [ %16, %11 ]
store i8 0, i8* %20
ret void
}
/* Variables and functions */
int /*<<< orphan*/ findtarget(int, char *);
xlcontinue(void) { findtarget(32, "not in a break loop"); }


x86 assembly (clang, -O0):
<xlcontinue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20,%edi
lea    0xedc(%rip),%rsi
call   1030 <findtarget@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlcontinue>:
lea    0xee9(%rip),%rsi
mov    $0x20,%edi
jmp    1030 <findtarget@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"not in a break loop\00"
define i32 @xlcontinue() {
%1 = alloca i32
%2 = call i32 @findtarget(i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [20 x i8] c"not in a break loop\00"
define i32 @xlcontinue() {
%1 = tail call i32 @findtarget(i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
struct itimerval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int getitimer(int which, struct itimerval *value) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<getitimer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getitimer>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.itimerval = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @getitimer(i32 %0, %struct.itimerval* %1) {
%3 = alloca i32
%4 = alloca %struct.itimerval*
store i32 %0, i32* %3
store %struct.itimerval* %1, %struct.itimerval** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.itimerval = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @getitimer(i32 %0, %struct.itimerval* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ delayms(int);
int /*<<< orphan*/ delayus(int);
int /*<<< orphan*/ gpio_high(int);
int /*<<< orphan*/ gpio_low(int);
void radio_reset(void) {
  gpio_high(25);
  delayms(150);
  gpio_low(25);
  delayus(100);
}


x86 assembly (clang, -O0):
<radio_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x19,%edi
call   1060 <gpio_high@plt>
mov    $0x96,%edi
call   1050 <delayms@plt>
mov    $0x19,%edi
call   1030 <gpio_low@plt>
mov    $0x64,%edi
call   1040 <delayus@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<radio_reset>:
push   %rax
mov    $0x19,%edi
call   1060 <gpio_high@plt>
mov    $0x96,%edi
call   1050 <delayms@plt>
mov    $0x19,%edi
call   1030 <gpio_low@plt>
mov    $0x64,%edi
pop    %rax
jmp    1040 <delayus@plt>

LLVM IR (-O0):
define void @radio_reset() {
%1 = call i32 @gpio_high(i32 25)
%2 = call i32 @delayms(i32 150)
%3 = call i32 @gpio_low(i32 25)
%4 = call i32 @delayus(i32 100)
ret void
}

LLVM IR (-O2):
define void @radio_reset() {
%1 = tail call i32 @gpio_high(i32 25)
%2 = tail call i32 @delayms(i32 150)
%3 = tail call i32 @gpio_low(i32 25)
%4 = tail call i32 @delayus(i32 100)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clr_bgEntry(int);
void free_bgEntries(void) {
  for (int i = 0; i < 20; i++) {
    clr_bgEntry(i);
  }
}


x86 assembly (clang, -O0):
<free_bgEntries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x14,-0x4(%rbp)
jge    113f <free_bgEntries+0x2f>
mov    -0x4(%rbp),%edi
call   1030 <clr_bgEntry@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <free_bgEntries+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_bgEntries>:
push   %rax
xor    %edi,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x1,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x2,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x3,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x4,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x5,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x6,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x7,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x8,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x9,%edi
call   1030 <clr_bgEntry@plt>
mov    $0xa,%edi
call   1030 <clr_bgEntry@plt>
mov    $0xb,%edi
call   1030 <clr_bgEntry@plt>
mov    $0xc,%edi
call   1030 <clr_bgEntry@plt>
mov    $0xd,%edi
call   1030 <clr_bgEntry@plt>
mov    $0xe,%edi
call   1030 <clr_bgEntry@plt>
mov    $0xf,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x10,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x11,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x12,%edi
call   1030 <clr_bgEntry@plt>
mov    $0x13,%edi
pop    %rax
jmp    1030 <clr_bgEntry@plt>

LLVM IR (-O0):
define void @free_bgEntries() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %8, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 20
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i32 @clr_bgEntry(i32 %6)
br label %8
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
br label %2
11: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @free_bgEntries() {
%1 = tail call i32 @clr_bgEntry(i32 0)
%2 = tail call i32 @clr_bgEntry(i32 1)
%3 = tail call i32 @clr_bgEntry(i32 2)
%4 = tail call i32 @clr_bgEntry(i32 3)
%5 = tail call i32 @clr_bgEntry(i32 4)
%6 = tail call i32 @clr_bgEntry(i32 5)
%7 = tail call i32 @clr_bgEntry(i32 6)
%8 = tail call i32 @clr_bgEntry(i32 7)
%9 = tail call i32 @clr_bgEntry(i32 8)
%10 = tail call i32 @clr_bgEntry(i32 9)
%11 = tail call i32 @clr_bgEntry(i32 10)
%12 = tail call i32 @clr_bgEntry(i32 11)
%13 = tail call i32 @clr_bgEntry(i32 12)
%14 = tail call i32 @clr_bgEntry(i32 13)
%15 = tail call i32 @clr_bgEntry(i32 14)
%16 = tail call i32 @clr_bgEntry(i32 15)
%17 = tail call i32 @clr_bgEntry(i32 16)
%18 = tail call i32 @clr_bgEntry(i32 17)
%19 = tail call i32 @clr_bgEntry(i32 18)
%20 = tail call i32 @clr_bgEntry(i32 19)
ret void
}
/* Variables and functions */
int IdentifiantBoutonPlosible(int);
int /*<<< orphan*/ printf(char *);
void testIdentifiantBoutonPlosible() {
  int identifiantBouton;
  int result = IdentifiantBoutonPlosible(identifiantBouton);
  if (1) {
    printf("%%TEST_FAILED%% time=0 testname=testIdentifiantBoutonPlosible "
           "(Test_gestioncommandes) message=error message sample\n");
  }
}


x86 assembly (clang, -O0):
<testIdentifiantBoutonPlosible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1040 <IdentifiantBoutonPlosible@plt>
mov    %eax,-0x8(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testIdentifiantBoutonPlosible>:
push   %rax
call   1040 <IdentifiantBoutonPlosible@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [116 x i8] c"%%TEST_FAILED%% time=0 testname=testIdentifiantBoutonPlosible (Test_gestioncommandes) message=error message sample\0A\00"
define void @testIdentifiantBoutonPlosible() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
%4 = call i32 @IdentifiantBoutonPlosible(i32 %3)
store i32 %4, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [116 x i8] c"%%TEST_FAILED%% time=0 testname=testIdentifiantBoutonPlosible (Test_gestioncommandes) message=error message sample\0A\00"
define void @testIdentifiantBoutonPlosible() {
%1 = tail call i32 @IdentifiantBoutonPlosible(i32 undef)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([116 x i8], [116 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned char USBD_GetLen(unsigned char *buf) {
  unsigned char len = 0;
  while (*buf != 0) {
    len++;
    buf++;
  }
  return len;
}


x86 assembly (clang, -O0):
<USBD_GetLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     1135 <USBD_GetLen+0x35>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <USBD_GetLen+0xc>
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBD_GetLen>:
cmpb   $0x0,(%rdi)
je     111c <USBD_GetLen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <USBD_GetLen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @USBD_GetLen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add i8 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i8 [ 0, %1 ], [ %7, %4 ]
ret i8 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ *jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ setjmp(int /*<<< orphan*/ *);
char *stack_next_frame(char *);
char *stack_top_frame() {
  jmp_buf buf;
  setjmp(buf);
  return stack_next_frame((char *)&(buf[0]));
}


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

x86 assembly (clang, -O2):
<stack_top_frame>:
push   %rax
call   1040 <setjmp@plt>
call   1030 <stack_next_frame@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i8* @stack_top_frame() {
%1 = alloca i32*
%2 = load i32*, i32** %1
%3 = call i32 @setjmp(i32* %2)
%4 = load i32*, i32** %1
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = bitcast i32* %5 to i8*
%7 = call i8* @stack_next_frame(i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @stack_top_frame() {
%1 = call i32 @setjmp(i32* undef)
%2 = call i8* @stack_next_frame(i8* poison)
ret i8* %2
}