xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t absolute(int32_t x) {
  int y = x >> 31;
  return (x ^ y) - y;
}


x86 assembly (clang, -O0):
<absolute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @absolute(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 31
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = xor i32 %6, %7
%9 = load i32, i32* %3
%10 = sub nsw i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @absolute(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void show_version(void) {
  puts("New RDOFF2 librarian/archiver, version "
       "0.1");
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"New RDOFF2 librarian/archiver, version 0.1\00"
define void @show_version() {
%1 = call i32 @puts(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"New RDOFF2 librarian/archiver, version 0.1\00"
define void @show_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
ret void
}
Us(nom) char *nom;
{
  printf("Usage: %s [-2] [entier]\n\n\t-2: sortie en base 2\n\tentier: nombre "
         "de decimales desirees.\n",
         nom);
  exit(1);
}


x86 assembly (clang, -O0):
<Us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Us>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [87 x i8] c"Usage: %s [-2] [entier]\0A\0A\09-2: sortie en base 2\0A\09entier: nombre de decimales desirees.\0A\00"
define i32 @Us(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0), i8* %3)
unreachable
}

LLVM IR (-O2):
@.str = [87 x i8] c"Usage: %s [-2] [entier]\0A\0A\09-2: sortie en base 2\0A\09entier: nombre de decimales desirees.\0A\00"
define i32 @Us(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0), i8* %0)
tail call void @exit(i32 1)
unreachable
}
float get_adc(void) {
  float a = 9;
  float b = a / 2;
  return b / 2;
}


x86 assembly (clang, -O0):
<get_adc>:
push   %rbp
mov    %rsp,%rbp
movss  0xef8(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xee2(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xecc(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_adc>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @get_adc() {
%1 = alloca float
%2 = alloca float
store float 9.000000e+00, float* %1
%3 = load float, float* %1
%4 = fdiv float %3, 2.000000e+00
store float %4, float* %2
%5 = load float, float* %2
%6 = fdiv float %5, 2.000000e+00
ret float %6
}

LLVM IR (-O2):
define float @get_adc() {
ret float 2.250000e+00
}
void audio_set_volume(int vol) {}


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

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

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

LLVM IR (-O2):
define void @audio_set_volume(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void childAbortHandler() { exit(100); }


x86 assembly (clang, -O0):
<childAbortHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<childAbortHandler>:
push   %rax
mov    $0x64,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @childAbortHandler() {
%1 = call i32 @exit(i32 100)
unreachable
}

LLVM IR (-O2):
define void @childAbortHandler() {
%1 = tail call i32 @exit(i32 100)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ val;
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bcopy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t uint_from_buf(uint8_t *buf) {
  uint32_t val;
  bcopy(buf, &val, sizeof(val));
  val = ntohl(val);
  return (val);
}


x86 assembly (clang, -O0):
<uint_from_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <bcopy@plt>
mov    -0xc(%rbp),%edi
call   1040 <ntohl@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @uint_from_buf(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @bcopy(i32* %4, i32* %3, i32 4)
%6 = load i32, i32* %3
%7 = call i32 @ntohl(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @uint_from_buf(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @ntohl(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ helloworld(char *);
int main() {
  char string[] = "Hello World";
  helloworld(string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <helloworld@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,0x8(%rsp)
movl   $0x646c72,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <helloworld@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.string = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
store i32 0, i32* %1
%3 = bitcast [12 x i8]* %2 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @helloworld(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @helloworld(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_short_max_to_all(short *target, short *source, int nreduce,
                                   int PE_start, int logPE_stride, int PE_size,
                                   short *pWrk, long *pSync) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_short_max_to_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_short_max_to_all(i16* %0, i16* %1, i32 %2, i32 %3, i32 %4, i32 %5, i16* %6, i64* %7) {
%9 = alloca i16*
%10 = alloca i16*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i16*
%16 = alloca i64*
store i16* %0, i16** %9
store i16* %1, i16** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i16* %6, i16** %15
store i64* %7, i64** %16
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_short_max_to_all(i16* nocapture readnone %0, i16* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5, i16* nocapture readnone %6, i64* nocapture readnone %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char sqrt(char);
char internal_sqrt_b(char value) { return sqrt(value); }


x86 assembly (clang, -O0):
<internal_sqrt_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
movsbl %al,%edi
call   1030 <sqrt@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_sqrt_b>:
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define signext i8 @internal_sqrt_b(i8 signext %0) {
%2 = tail call signext i8 @sqrt(i8 signext %0)
ret i8 %2
}
/* Type definitions */
struct mcs_pdr_lock {
  int dummy;
};
struct mcs_lock_qnode {
  int dummy;
};
struct mcs_lock {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mcs_lock_unlock(struct mcs_lock *, struct mcs_lock_qnode *);
void mcs_pdr_unlock(struct mcs_pdr_lock *pdr_lock,
                    struct mcs_lock_qnode *qnode) {
  mcs_lock_unlock((struct mcs_lock *)pdr_lock, qnode);
}


x86 assembly (clang, -O0):
<mcs_pdr_unlock>:
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 <mcs_lock_unlock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcs_pdr_unlock>:
jmp    1030 <mcs_lock_unlock@plt>

LLVM IR (-O0):
%struct.mcs_pdr_lock = type { i32 }
%struct.mcs_lock_qnode = type { i32 }
%struct.mcs_lock = type { i32 }
define void @mcs_pdr_unlock(%struct.mcs_pdr_lock* %0, %struct.mcs_lock_qnode* %1) {
%3 = alloca %struct.mcs_pdr_lock*
%4 = alloca %struct.mcs_lock_qnode*
store %struct.mcs_pdr_lock* %0, %struct.mcs_pdr_lock** %3
store %struct.mcs_lock_qnode* %1, %struct.mcs_lock_qnode** %4
%5 = load %struct.mcs_pdr_lock*, %struct.mcs_pdr_lock** %3
%6 = bitcast %struct.mcs_pdr_lock* %5 to %struct.mcs_lock*
%7 = load %struct.mcs_lock_qnode*, %struct.mcs_lock_qnode** %4
%8 = call i32 @mcs_lock_unlock(%struct.mcs_lock* %6, %struct.mcs_lock_qnode* %7)
ret void
}

LLVM IR (-O2):
%struct.mcs_pdr_lock = type { i32 }
%struct.mcs_lock_qnode = type { i32 }
%struct.mcs_lock = type { i32 }
define void @mcs_pdr_unlock(%struct.mcs_pdr_lock* %0, %struct.mcs_lock_qnode* %1) {
%3 = bitcast %struct.mcs_pdr_lock* %0 to %struct.mcs_lock*
%4 = tail call i32 @mcs_lock_unlock(%struct.mcs_lock* %3, %struct.mcs_lock_qnode* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ optdevider(char const);
int getoptlen(const char *str) {
  int i = 0;
  while (!optdevider(str[i]))
    i++;
  return i;
}


x86 assembly (clang, -O0):
<getoptlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <optdevider@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1149 <getoptlen+0x39>
jmp    1157 <getoptlen+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <getoptlen+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getoptlen>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xffffffff,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <optdevider@plt>
add    $0x1,%ebp
add    $0x1,%rbx
test   %eax,%eax
je     1120 <getoptlen+0x10>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getoptlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %8, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i32 @optdevider(i8 signext %5)
%7 = icmp eq i32 %6, 0
%8 = add nuw i64 %3, 1
br i1 %7, label %2, label %9
9: ; preds = %2
%10 = trunc i64 %3 to i32
ret i32 %10
}
double sum(const double *begin, const double *end) {
  double retVal = 0;
  while (begin < end) {
    retVal += *begin;
    ++begin;
  }
  return retVal;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1145 <sum+0x45>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <sum+0x14>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
xorpd  %xmm0,%xmm0
cmp    %rsi,%rdi
jae    111d <sum+0x1d>
xorpd  %xmm0,%xmm0
nopl   (%rax)
addsd  (%rdi),%xmm0
add    $0x8,%rdi
cmp    %rsi,%rdi
jb     1110 <sum+0x10>
ret

LLVM IR (-O0):
define double @sum(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 0.000000e+00, double* %5
br label %6
6: ; preds = %10, %2
%7 = load double*, double** %3
%8 = load double*, double** %4
%9 = icmp ult double* %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load double*, double** %3
%12 = load double, double* %11
%13 = load double, double* %5
%14 = fadd double %13, %12
store double %14, double* %5
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i32 1
store double* %16, double** %3
br label %6
17: ; preds = %6
%18 = load double, double* %5
ret double %18
}

LLVM IR (-O2):
define double @sum(double* %0, double* readnone %1) {
%3 = icmp ult double* %0, %1
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi double [ %8, %4 ], [ 0.000000e+00, %2 ]
%6 = phi double* [ %9, %4 ], [ %0, %2 ]
%7 = load double, double* %6
%8 = fadd double %5, %7
%9 = getelementptr inbounds double, double* %6, i64 1
%10 = icmp ult double* %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
%12 = phi double [ 0.000000e+00, %2 ], [ %8, %4 ]
ret double %12
}
/* Variables and functions */
int foo2();
int foo1(void) { return foo2(); }


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

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

LLVM IR (-O0):
define i32 @foo1() {
%1 = call i32 (...) @foo2()
ret i32 %1
}

LLVM IR (-O2):
define i32 @foo1() {
%1 = tail call i32 (...) @foo2()
ret i32 %1
}
/* Variables and functions */
scalar_t__ fetch(int);
int ifetch();
int /*<<< orphan*/ store(int, scalar_t__);
void slotinc() {
  int addr = ifetch() * 8 + 8 + 2;
  store(addr, fetch(addr) + 1);
}


x86 assembly (clang, -O0):
<slotinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <ifetch@plt>
shl    $0x3,%eax
add    $0x8,%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fetch@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rsi
add    $0x1,%rsi
call   1030 <store@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slotinc>:
push   %rbx
xor    %eax,%eax
call   1050 <ifetch@plt>
lea    0xa(,%rax,8),%ebx
mov    %ebx,%edi
call   1040 <fetch@plt>
lea    0x1(%rax),%rsi
mov    %ebx,%edi
pop    %rbx
jmp    1030 <store@plt>

LLVM IR (-O0):
define void @slotinc() {
%1 = alloca i32
%2 = call i32 (...) @ifetch()
%3 = mul nsw i32 %2, 8
%4 = add nsw i32 %3, 8
%5 = add nsw i32 %4, 2
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = load i32, i32* %1
%8 = call i64 @fetch(i32 %7)
%9 = add nsw i64 %8, 1
%10 = call i32 @store(i32 %6, i64 %9)
ret void
}

LLVM IR (-O2):
define void @slotinc() {
%1 = tail call i32 (...) @ifetch()
%2 = shl nsw i32 %1, 3
%3 = add nsw i32 %2, 10
%4 = tail call i64 @fetch(i32 %3)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @store(i32 %3, i64 %5)
ret void
}
extern int identity(int x) { return 10; }


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

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

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

LLVM IR (-O2):
define i32 @identity(i32 %0) {
ret i32 10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void output_color_normal() { printf("\033[0m"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[0m\00"
define void @output_color_normal() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_mod_koma_complex_noun();
int main(void) {
  test_mod_koma_complex_noun();
  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_mod_koma_complex_noun@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_mod_koma_complex_noun@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_mod_koma_complex_noun()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_mod_koma_complex_noun()
ret i32 0
}
/* Variables and functions */
int read(int, char *, size_t);
int serial_recv(int fd, char *buf, size_t buflen) {
  return read(fd, buf, buflen);
}


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

x86 assembly (clang, -O2):
<serial_recv>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @serial_recv(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int cmp_less_int32(const void *p, const void *q) {
  const int32_t a = *(const int32_t *)p;
  const int32_t b = *(const int32_t *)q;
  if (a > b)
    return +1;
  if (b > a)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_less_int32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    113c <cmp_less_int32+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    115d <cmp_less_int32+0x5d>
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jle    1156 <cmp_less_int32+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <cmp_less_int32+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_less_int32>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
xor    %edx,%edx
cmp    %rax,%rcx
setg   %dl
neg    %edx
cmp    %rcx,%rax
mov    $0x1,%eax
cmovle %edx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_less_int32(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i64*
%10 = load i64, i64* %9
store i64 %10, i64* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i64*
%13 = load i64, i64* %12
store i64 %13, i64* %7
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = icmp sgt i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %24
18: ; preds = %2
%19 = load i64, i64* %7
%20 = load i64, i64* %6
%21 = icmp sgt i64 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @cmp_less_int32(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp sgt i64 %4, %6
%8 = icmp sgt i64 %6, %4
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ malloc(int);
int main() {
  for (;;)
    malloc(100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1030 <malloc@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1030 <malloc@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %2, %0
%3 = call i32 @malloc(i32 100)
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @malloc(i32 100)
br label %1
}
int subr2(int parm) {
  int keeping, busy;
  keeping = parm + parm;
  busy = keeping * keeping;
  return busy;
}


x86 assembly (clang, -O0):
<subr2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<subr2>:
lea    (%rdi,%rdi,1),%eax
imul   %eax,%eax
ret

LLVM IR (-O0):
define i32 @subr2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = add nsw i32 %5, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %4
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
define i32 @subr2(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = mul nsw i32 %2, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int trailingZeroes(int);
void main() {
  int n = 26;
  int res = trailingZeroes(n);
  printf("Result trailing zeroes of %d is : %d\n", n, res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1a,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <trailingZeroes@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1a,%edi
call   1040 <trailingZeroes@plt>
lea    0xece(%rip),%rdi
mov    $0x1a,%esi
mov    %eax,%edx
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Result trailing zeroes of %d is : %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 26, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @trailingZeroes(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Result trailing zeroes of %d is : %d\0A\00"
define void @main() {
%1 = tail call i32 @trailingZeroes(i32 26)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 26, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int sum(int);
int main() {
  int n;
  printf("Enter the limit");
  scanf("%d", &n);
  printf("sum=%d", sum(n));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"Enter the limit\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"sum=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @sum(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sched_yield();
void __pmp_yield(void) { sched_yield(); }


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

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

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

LLVM IR (-O2):
define void @__pmp_yield() {
%1 = tail call i32 (...) @sched_yield()
ret void
}
/* Variables and functions */
int byteswap(int);
int readdata(int, int *, int);
int scmerr(int, char *);
int readmend(void) {
  int x;
  int y;
  x = readdata(sizeof(int), &y, false);
  y = byteswap(y);
  if (x == (1) && y != (-1))
    return (scmerr(-1, "Error reading end of message"));
  return (x);
}


x86 assembly (clang, -O0):
<readmend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
lea    -0xc(%rbp),%rsi
xor    %edx,%edx
call   1030 <readdata@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <byteswap@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1183 <readmend+0x53>
cmpl   $0xffffffff,-0xc(%rbp)
je     1183 <readmend+0x53>
mov    $0xffffffff,%edi
lea    0xe8a(%rip),%rsi
call   1040 <scmerr@plt>
mov    %eax,-0x4(%rbp)
jmp    1189 <readmend+0x59>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readmend>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
mov    $0x4,%edi
xor    %edx,%edx
call   1030 <readdata@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
call   1050 <byteswap@plt>
mov    %eax,0xc(%rsp)
cmp    $0x1,%ebx
jne    1172 <readmend+0x42>
cmp    $0xffffffff,%eax
je     1172 <readmend+0x42>
lea    0xe9a(%rip),%rsi
mov    $0xffffffff,%edi
call   1040 <scmerr@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Error reading end of message\00"
define i32 @readmend() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @readdata(i32 4, i32* %3, i32 0)
store i32 %4, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @byteswap(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @scmerr(i32 -1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %1
br label %16
14: ; preds = %9, %0
%15 = load i32, i32* %2
store i32 %15, i32* %1
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [29 x i8] c"Error reading end of message\00"
define i32 @readmend() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @readdata(i32 4, i32* %1, i32 0)
%4 = load i32, i32* %1
%5 = call i32 @byteswap(i32 %4)
store i32 %5, i32* %1
%6 = icmp eq i32 %3, 1
%7 = icmp ne i32 %5, -1
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @scmerr(i32 -1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %0, %9
%12 = phi i32 [ %10, %9 ], [ %3, %0 ]
ret i32 %12
}
/* Type definitions */
struct rtattr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ parse_rtattr_flags(struct rtattr **, int, struct rtattr *,
                                      int, int /*<<< orphan*/);
void parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) {
  parse_rtattr_flags(tb, max, rta, len, 0);
}


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

x86 assembly (clang, -O2):
<parse_rtattr>:
xor    %r8d,%r8d
jmp    1030 <parse_rtattr_flags@plt>

LLVM IR (-O0):
%struct.rtattr = type { i32 }
define void @parse_rtattr(%struct.rtattr** %0, i32 %1, %struct.rtattr* %2, i32 %3) {
%5 = alloca %struct.rtattr**
%6 = alloca i32
%7 = alloca %struct.rtattr*
%8 = alloca i32
store %struct.rtattr** %0, %struct.rtattr*** %5
store i32 %1, i32* %6
store %struct.rtattr* %2, %struct.rtattr** %7
store i32 %3, i32* %8
%9 = load %struct.rtattr**, %struct.rtattr*** %5
%10 = load i32, i32* %6
%11 = load %struct.rtattr*, %struct.rtattr** %7
%12 = load i32, i32* %8
%13 = call i32 @parse_rtattr_flags(%struct.rtattr** %9, i32 %10, %struct.rtattr* %11, i32 %12, i32 0)
ret void
}

LLVM IR (-O2):
%struct.rtattr = type { i32 }
define void @parse_rtattr(%struct.rtattr** %0, i32 %1, %struct.rtattr* %2, i32 %3) {
%5 = tail call i32 @parse_rtattr_flags(%struct.rtattr** %0, i32 %1, %struct.rtattr* %2, i32 %3, i32 0)
ret void
}
/* Variables and functions */
int a2();
int c(void) { return a2(); }


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

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

LLVM IR (-O0):
define i32 @c() {
%1 = call i32 (...) @a2()
ret i32 %1
}

LLVM IR (-O2):
define i32 @c() {
%1 = tail call i32 (...) @a2()
ret i32 %1
}
/* Type definitions */
struct in6_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(struct in6_addr *, struct in6_addr const *, int);
struct in6_addr *in6_addr_copy(struct in6_addr *dest,
                               const struct in6_addr *src) {
  memcpy(dest, src, sizeof(struct in6_addr));
  return dest;
}


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

x86 assembly (clang, -O2):
<in6_addr_copy>:
push   %rbx
mov    %rdi,%rbx
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.in6_addr = type { i32 }
define %struct.in6_addr* @in6_addr_copy(%struct.in6_addr* %0, %struct.in6_addr* %1) {
%3 = alloca %struct.in6_addr*
%4 = alloca %struct.in6_addr*
store %struct.in6_addr* %0, %struct.in6_addr** %3
store %struct.in6_addr* %1, %struct.in6_addr** %4
%5 = load %struct.in6_addr*, %struct.in6_addr** %3
%6 = load %struct.in6_addr*, %struct.in6_addr** %4
%7 = call i32 @memcpy(%struct.in6_addr* %5, %struct.in6_addr* %6, i32 4)
%8 = load %struct.in6_addr*, %struct.in6_addr** %3
ret %struct.in6_addr* %8
}

LLVM IR (-O2):
%struct.in6_addr = type { i32 }
define %struct.in6_addr* @in6_addr_copy(%struct.in6_addr* returned %0, %struct.in6_addr* %1) {
%3 = tail call i32 @memcpy(%struct.in6_addr* %0, %struct.in6_addr* %1, i32 4)
ret %struct.in6_addr* %0
}
/* Variables and functions */
int /*<<< orphan*/ s2sci(int);
void s2sci_(int *idx) { s2sci(*idx); }


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

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

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

LLVM IR (-O2):
define void @s2sci_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @s2sci(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hello, World!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int cast_short_uint_fast(short int x) { return (unsigned int)x; }


x86 assembly (clang, -O0):
<cast_short_uint_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cast_short_uint_fast(i16 signext %0) {
%2 = sext i16 %0 to i32
ret i32 %2
}
/* Type definitions */
struct ndpi_LruCache {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ndpi_add_to_lru_cache_str_timeout(struct ndpi_LruCache *,
                                                     char *, char *,
                                                     int /*<<< orphan*/);
int ndpi_add_to_lru_cache_str(struct ndpi_LruCache *cache, char *key,
                              char *value) {
  ndpi_add_to_lru_cache_str_timeout(cache, key, value, 0);
  return (0);
}


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

x86 assembly (clang, -O2):
<ndpi_add_to_lru_cache_str>:
push   %rax
xor    %ecx,%ecx
call   1030 <ndpi_add_to_lru_cache_str_timeout@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.ndpi_LruCache = type { i32 }
define i32 @ndpi_add_to_lru_cache_str(%struct.ndpi_LruCache* %0, i8* %1, i8* %2) {
%4 = tail call i32 @ndpi_add_to_lru_cache_str_timeout(%struct.ndpi_LruCache* %0, i8* %1, i8* %2, i32 0)
ret i32 0
}
void d2i_AUTHORITY_KEYID(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_AUTHORITY_KEYID() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *strdup(char const *);
char *hstrdup(const char *s) {
  char *o = strdup(s);
  if (o == NULL) {
    fprintf(stderr, "owfs-tlm"
                    ": out of memory\n");
    abort();
  }
  return o;
}


x86 assembly (clang, -O0):
<hstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <hstrdup+0x40>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hstrdup>:
push   %rax
call   1050 <strdup@plt>
test   %rax,%rax
je     113d <hstrdup+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"owfs-tlm: out of memory\0A\00"
define i8* @hstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"owfs-tlm: out of memory\0A\00"
define noalias i8* @hstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ cleanup();
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *);
int /*<<< orphan*/ exit(int);
char *malloc(unsigned int);
char *xmalloc(unsigned int n) {
  char *p;
  p = malloc(n);
  if (p == 0) {
    error(0, 0, "virtual memory exhausted");
    cleanup();
    exit(2);
  }
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <xmalloc+0x43>
xor    %esi,%esi
lea    0xe95(%rip),%rdx
mov    %esi,%edi
call   1040 <error@plt>
mov    $0x0,%al
call   1050 <cleanup@plt>
mov    $0x2,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1030 <malloc@plt>
test   %rax,%rax
je     114d <xmalloc+0xd>
pop    %rcx
ret
lea    0xeac(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <error@plt>
xor    %eax,%eax
call   1050 <cleanup@plt>
mov    $0x2,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @error(i32 0, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @cleanup()
%11 = call i32 @exit(i32 2)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [25 x i8] c"virtual memory exhausted\00"
define noalias i8* @xmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @error(i32 0, i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @cleanup()
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ CopyToVRAM(int /*<<< orphan*/ volatile *,
                              int /*<<< orphan*/ const *, int);
void LoadTile8(int charblock, int tile_num, const uint8_t tile_data[64]) {
  CopyToVRAM(((volatile uint16_t *)(0x6000000)) + (charblock * 8192) +
                 (tile_num * 32),
             (const uint16_t *)tile_data, 32);
}


x86 assembly (clang, -O0):
<LoadTile8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xd,%eax
cltq
mov    $0x6000000,%edi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%eax
shl    $0x5,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x20,%edx
call   1030 <CopyToVRAM@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoadTile8>:
shl    $0xd,%edi
movslq %edi,%rax
shl    $0x5,%esi
movslq %esi,%rcx
shl    $0x2,%rcx
lea    (%rcx,%rax,4),%rdi
add    $0x6000000,%rdi
mov    %rdx,%rsi
mov    $0x20,%edx
jmp    1030 <CopyToVRAM@plt>

LLVM IR (-O0):
define void @LoadTile8(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 = mul nsw i32 %7, 8192
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* inttoptr (i64 100663296 to i32*), i64 %9
%11 = load i32, i32* %5
%12 = mul nsw i32 %11, 32
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %10, i64 %13
%15 = load i32*, i32** %6
%16 = call i32 @CopyToVRAM(i32* %14, i32* %15, i32 32)
ret void
}

LLVM IR (-O2):
define void @LoadTile8(i32 %0, i32 %1, i32* %2) {
%4 = shl nsw i32 %0, 13
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* inttoptr (i64 100663296 to i32*), i64 %5
%7 = shl nsw i32 %1, 5
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = tail call i32 @CopyToVRAM(i32* %9, i32* %2, i32 32)
ret void
}
/* Variables and functions */
int set_debug_level(int);
int set_debug_switch(int);
int set_debug_options(int dbgswitch, int dbglevel) {
  int retval = 0;
  if ((retval = set_debug_switch(dbgswitch)) != -1)
    retval = set_debug_level(dbglevel);
  return retval;
}


x86 assembly (clang, -O0):
<set_debug_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <set_debug_switch@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
je     1154 <set_debug_options+0x34>
mov    -0x8(%rbp),%edi
call   1030 <set_debug_level@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_debug_options>:
push   %rbx
mov    %esi,%ebx
call   1040 <set_debug_switch@plt>
cmp    $0xffffffff,%eax
je     1135 <set_debug_options+0x15>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <set_debug_level@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @set_debug_options(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = call i32 @set_debug_switch(i32 %6)
store i32 %7, i32* %5
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @set_debug_level(i32 %10)
store i32 %11, i32* %5
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @set_debug_options(i32 %0, i32 %1) {
%3 = tail call i32 @set_debug_switch(i32 %0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @set_debug_level(i32 %1)
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_usage(char *prog) {
  fprintf(stderr, "Usage %s ip_address:port filename\n", prog);
}


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

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Usage %s ip_address:port filename\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Usage %s ip_address:port filename\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
short(wcheck_short)(short to_check) { return to_check; }


x86 assembly (clang, -O0):
<wcheck_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @wcheck_short(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define signext i16 @wcheck_short(i16 returned signext %0) {
ret i16 %0
}
int main(void) {
  double x, y, z;
  x = y + z;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}