xunge/DecIR huggingface dataset:
/* Variables and functions */
void *malloc(unsigned int);
void *HoloStor_TableAlloc(unsigned int size) { return malloc(size); }


x86 assembly (clang, -O0):
<HoloStor_TableAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HoloStor_TableAlloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @HoloStor_TableAlloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
int lower_one_mask(int x, int n) {
  int mask = (2 << (n - 1)) - 1;
  return mask & x;
}


x86 assembly (clang, -O0):
<lower_one_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x2,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_one_mask>:
lea    -0x1(%rsi),%ecx
mov    $0x2,%eax
shl    %cl,%eax
add    $0xffffffff,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @lower_one_mask(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 = sub nsw i32 %6, 1
%8 = shl i32 2, %7
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = and i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @lower_one_mask(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = shl i32 2, %3
%5 = add nsw i32 %4, -1
%6 = and i32 %5, %0
ret i32 %6
}
/* Variables and functions */
int dup2(int, int);
bool terminal_dup2(int duplicate, int original) {
  int ret;
  ret = dup2(duplicate, original);
  if (ret < 0)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<terminal_dup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <dup2@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1142 <terminal_dup2+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1149 <terminal_dup2+0x39>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminal_dup2>:
push   %rax
call   1030 <dup2@plt>
not    %eax
shr    $0x1f,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @terminal_dup2(i32 %0, i32 %1) {
%3 = tail call i32 @dup2(i32 %0, i32 %1)
%4 = xor i32 %3, -1
%5 = lshr i32 %4, 31
ret i32 %5
}
/* Type definitions */
struct mbuf {
  int dummy;
};

/* Variables and functions */
struct mbuf *m_free(struct mbuf *);
void m_freem(struct mbuf *bp) {
  while (bp)
    bp = m_free(bp);
}


x86 assembly (clang, -O0):
<m_freem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1139 <m_freem+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <m_free@plt>
mov    %rax,-0x8(%rbp)
jmp    111c <m_freem+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_freem>:
push   %rax
test   %rdi,%rdi
je     112d <m_freem+0x1d>
mov    %rdi,%rax
nopl   0x0(%rax)
mov    %rax,%rdi
call   1030 <m_free@plt>
test   %rax,%rax
jne    1120 <m_freem+0x10>
pop    %rax
ret

LLVM IR (-O0):
%struct.mbuf = type { i32 }
define void @m_freem(%struct.mbuf* %0) {
%2 = alloca %struct.mbuf*
store %struct.mbuf* %0, %struct.mbuf** %2
br label %3
3: ; preds = %6, %1
%4 = load %struct.mbuf*, %struct.mbuf** %2
%5 = icmp ne %struct.mbuf* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load %struct.mbuf*, %struct.mbuf** %2
%8 = call %struct.mbuf* @m_free(%struct.mbuf* %7)
store %struct.mbuf* %8, %struct.mbuf** %2
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.mbuf = type { i32 }
define void @m_freem(%struct.mbuf* %0) {
%2 = icmp eq %struct.mbuf* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1, %3
%4 = phi %struct.mbuf* [ %5, %3 ], [ %0, %1 ]
%5 = tail call %struct.mbuf* @m_free(%struct.mbuf* %4)
%6 = icmp eq %struct.mbuf* %5, null
br i1 %6, label %7, label %3
7: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ proc_imprime(char *);
int main() {
  proc_imprime("teste");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"teste\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @proc_imprime(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"teste\00"
define i32 @main() {
%1 = tail call i32 @proc_imprime(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int getifssid(const char *ifname, char *ssid) {
  ifname = ssid;
  return -1;
}


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

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

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

LLVM IR (-O2):
define i32 @getifssid(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
void inv_q_invert(const long *q, long *qInverted) {
  typedef int invensensePutFunctionCallsHere;
  qInverted[0] = q[0];
  qInverted[1] = -q[1];
  qInverted[2] = -q[2];
  qInverted[3] = -q[3];
}


x86 assembly (clang, -O0):
<inv_q_invert>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    0x8(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    0x10(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    0x18(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_q_invert>:
mov    (%rdi),%rax
mov    %rax,(%rsi)
xor    %eax,%eax
xor    %ecx,%ecx
sub    0x8(%rdi),%rcx
mov    %rcx,0x8(%rsi)
xor    %ecx,%ecx
sub    0x10(%rdi),%rcx
mov    %rcx,0x10(%rsi)
sub    0x18(%rdi),%rax
mov    %rax,0x18(%rsi)
ret

LLVM IR (-O0):
define void @inv_q_invert(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %3
%6 = getelementptr inbounds i64, i64* %5, i64 0
%7 = load i64, i64* %6
%8 = load i64*, i64** %4
%9 = getelementptr inbounds i64, i64* %8, i64 0
store i64 %7, i64* %9
%10 = load i64*, i64** %3
%11 = getelementptr inbounds i64, i64* %10, i64 1
%12 = load i64, i64* %11
%13 = sub nsw i64 0, %12
%14 = load i64*, i64** %4
%15 = getelementptr inbounds i64, i64* %14, i64 1
store i64 %13, i64* %15
%16 = load i64*, i64** %3
%17 = getelementptr inbounds i64, i64* %16, i64 2
%18 = load i64, i64* %17
%19 = sub nsw i64 0, %18
%20 = load i64*, i64** %4
%21 = getelementptr inbounds i64, i64* %20, i64 2
store i64 %19, i64* %21
%22 = load i64*, i64** %3
%23 = getelementptr inbounds i64, i64* %22, i64 3
%24 = load i64, i64* %23
%25 = sub nsw i64 0, %24
%26 = load i64*, i64** %4
%27 = getelementptr inbounds i64, i64* %26, i64 3
store i64 %25, i64* %27
ret void
}

LLVM IR (-O2):
define void @inv_q_invert(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
store i64 %3, i64* %1
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = sub nsw i64 0, %5
%7 = getelementptr inbounds i64, i64* %1, i64 1
store i64 %6, i64* %7
%8 = getelementptr inbounds i64, i64* %0, i64 2
%9 = load i64, i64* %8
%10 = sub nsw i64 0, %9
%11 = getelementptr inbounds i64, i64* %1, i64 2
store i64 %10, i64* %11
%12 = getelementptr inbounds i64, i64* %0, i64 3
%13 = load i64, i64* %12
%14 = sub nsw i64 0, %13
%15 = getelementptr inbounds i64, i64* %1, i64 3
store i64 %14, i64* %15
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void get_time(struct timespec *tp) {
  clockid_t cid = CLOCK_REALTIME;
  if (clock_gettime(cid, tp) != 0) {
    do {
      printf("%s\n", "failed to get nano time");
      exit(-1);
    } while (0);
  }
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0x0,%rax
je     1180 <get_time+0x50>
jmp    1163 <get_time+0x33>
lea    0xe96(%rip),%rdi
lea    0xe93(%rip),%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %rax
mov    %rdi,%rsi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <clock_gettime@plt>
test   %rax,%rax
jne    1149 <get_time+0x19>
pop    %rax
ret
lea    0xeb0(%rip),%rdi
lea    0xead(%rip),%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [24 x i8] c"failed to get nano time\00"
define void @get_time(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
%3 = alloca i32
store %struct.timespec* %0, %struct.timespec** %2
%4 = load i32, i32* @CLOCK_REALTIME
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = load %struct.timespec*, %struct.timespec** %2
%7 = call i64 @clock_gettime(i32 %5, %struct.timespec* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
br label %10
10: ; preds = %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; No predecessors!
br label %14
14: ; preds = %13, %1
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [24 x i8] c"failed to get nano time\00"
define void @get_time(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_REALTIME
%3 = tail call i64 @clock_gettime(i32 %2, %struct.timespec* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float amount;
  printf("Enter an amount: ");
  scanf("%f", &amount);
  printf("With tax added: $%.2f\n", amount + (amount * 0.05f));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movss  0xea1(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xeb2(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter an amount: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"With tax added: $%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 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), float* %2)
%5 = load float, float* %2
%6 = load float, float* %2
%7 = call float @llvm.fmuladd.f32(float %6, float 0x3FA99999A0000000, float %5)
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter an amount: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"With tax added: $%.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 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), float* %1)
%5 = load float, float* %1
%6 = call float @llvm.fmuladd.f32(float %5, float 0x3FA99999A0000000, float %5)
%7 = fpext float %6 to double
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void mwait() {
  db(0x0F);
  db(0x01);
  db(0xC9);
}


x86 assembly (clang, -O0):
<mwait>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0x1,%edi
call   1030 <db@plt>
mov    $0xc9,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mwait>:
push   %rax
mov    $0xf,%edi
call   1030 <db@plt>
mov    $0x1,%edi
call   1030 <db@plt>
mov    $0xc9,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @mwait() {
%1 = call i32 @db(i32 15)
%2 = call i32 @db(i32 1)
%3 = call i32 @db(i32 201)
ret void
}

LLVM IR (-O2):
define void @mwait() {
%1 = tail call i32 @db(i32 15)
%2 = tail call i32 @db(i32 1)
%3 = tail call i32 @db(i32 201)
ret void
}
void replace_char(char *s, char old, char new) {
  while (*s) {
    if (*s == old) {
      *s = new;
    }
    s++;
  }
}


x86 assembly (clang, -O0):
<replace_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <replace_char+0x4d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    113c <replace_char+0x3c>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <replace_char+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_char>:
mov    (%rdi),%al
test   %al,%al
je     1125 <replace_char+0x25>
add    $0x1,%rdi
jmp    111b <replace_char+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1125 <replace_char+0x25>
cmp    %sil,%al
jne    1110 <replace_char+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <replace_char+0x10>
ret

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

LLVM IR (-O2):
define void @replace_char(i8* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = icmp eq i8 %7, %1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 %2, i8* %8
br label %11
11: ; preds = %10, %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %11, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _TIFFsetByteArray(void **, void *, long);
void _TIFFsetNString(char **cpp, char *cp, long n) {
  _TIFFsetByteArray((void **)cpp, (void *)cp, n);
}


x86 assembly (clang, -O0):
<_TIFFsetNString>:
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
call   1030 <_TIFFsetByteArray@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_TIFFsetNString>:
jmp    1030 <_TIFFsetByteArray@plt>

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

LLVM IR (-O2):
define void @_TIFFsetNString(i8** %0, i8* %1, i64 %2) {
%4 = tail call i32 @_TIFFsetByteArray(i8** %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getNumber(double *);
double tanh(double);
double tangenteh(double a) {
  getNumber(&a);
  return tanh(a);
}


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

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

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

LLVM IR (-O2):
define double @tangenteh(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 @getNumber(double* %2)
%4 = load double, double* %2
%5 = call double @tanh(double %4)
ret double %5
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ INIT_LIST_HEAD(struct list_head *);
int /*<<< orphan*/ list_replace(struct list_head *, struct list_head *);
void list_replace_init(struct list_head *old, struct list_head *add) {
  list_replace(old, add);
  INIT_LIST_HEAD(old);
}


x86 assembly (clang, -O0):
<list_replace_init>:
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   1040 <list_replace@plt>
mov    -0x8(%rbp),%rdi
call   1030 <INIT_LIST_HEAD@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_replace_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <list_replace@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <INIT_LIST_HEAD@plt>

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

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_replace(%struct.list_head* %0, %struct.list_head* %1)
%4 = tail call i32 @INIT_LIST_HEAD(%struct.list_head* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void aligned_free(void *p) {
  size_t adj_size;
  unsigned long real_p;
  if (p == NULL)
    return;
  adj_size = ((size_t *)p)[-1];
  real_p = (unsigned long)p - adj_size;
  free((void *)real_p);
}


x86 assembly (clang, -O0):
<aligned_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <aligned_free+0x1c>
jmp    114d <aligned_free+0x3d>
mov    -0x8(%rbp),%rax
mov    -0x8(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aligned_free>:
test   %rdi,%rdi
je     111e <aligned_free+0xe>
sub    -0x8(%rdi),%rdi
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @aligned_free(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
br label %20
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = bitcast i8* %9 to i64*
%11 = getelementptr inbounds i64, i64* %10, i64 -1
%12 = load i64, i64* %11
store i64 %12, i64* %3
%13 = load i8*, i8** %2
%14 = ptrtoint i8* %13 to i64
%15 = load i64, i64* %3
%16 = sub i64 %14, %15
store i64 %16, i64* %4
%17 = load i64, i64* %4
%18 = inttoptr i64 %17 to i8*
%19 = call i32 @free(i8* %18)
br label %20
20: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
define void @aligned_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 -8
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %7, %6
%9 = inttoptr i64 %8 to i8*
%10 = tail call i32 @free(i8* %9)
br label %11
11: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ accumtestNew();
int /*<<< orphan*/ oosmos_DelayMS(int);
int /*<<< orphan*/ oosmos_RunStateMachines();
extern int main(void) {
  (void)accumtestNew();
  for (;;) {
    oosmos_RunStateMachines();
    oosmos_DelayMS(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <accumtestNew@plt>
mov    $0x0,%al
call   1050 <oosmos_RunStateMachines@plt>
mov    $0x1,%edi
call   1040 <oosmos_DelayMS@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <accumtestNew@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <oosmos_RunStateMachines@plt>
mov    $0x1,%edi
call   1040 <oosmos_DelayMS@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @accumtestNew()
br label %3
3: ; preds = %3, %0
%4 = call i32 (...) @oosmos_RunStateMachines()
%5 = call i32 @oosmos_DelayMS(i32 1)
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @accumtestNew()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @oosmos_RunStateMachines()
%4 = tail call i32 @oosmos_DelayMS(i32 1)
br label %2
}
void invalid_tss_handler(struct exception_info *info) {
  asm volatile("" : : :);
  asm volatile("hlt");
}


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

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

LLVM IR (-O0):
%struct.exception_info = type opaque
define void @invalid_tss_handler(%struct.exception_info* %0) {
%2 = alloca %struct.exception_info*
store %struct.exception_info* %0, %struct.exception_info** %2
ret void
}

LLVM IR (-O2):
%struct.exception_info = type opaque
define void @invalid_tss_handler(%struct.exception_info* nocapture readnone %0) {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void __memzero(void *s, size_t count) { memset(s, 0, count); }


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

x86 assembly (clang, -O2):
<__memzero>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @__memzero(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @memset(i8* %5, i32 0, i64 %6)
ret void
}

LLVM IR (-O2):
define void @__memzero(i8* %0, i64 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i64 %1)
ret void
}
int main(int argc, char *argv[]) {
  int pid;
  int status;
  if (!(pid = fork())) {
    goto testt;
    exit(0x9f);
  } else {
    wait(&status);
  }
  if (status == 0x9) {
    printf(1, "TEST1:OK\n");
  } else {
    printf(1, "FAILED\n");
  }
testt:
  return 9;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    115e <main+0x2e>
jmp    11a3 <main+0x73>
lea    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <wait@plt>
cmpl   $0x9,-0x18(%rbp)
jne    118b <main+0x5b>
mov    $0x1,%edi
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <main+0x6e>
mov    $0x1,%edi
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a3 <main+0x73>
mov    $0x9,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
test   %eax,%eax
je     116b <main+0x3b>
lea    0x4(%rsp),%rdi
xor    %eax,%eax
call   1040 <wait@plt>
cmpl   $0x9,0x4(%rsp)
lea    0xeac(%rip),%rax
lea    0xeaf(%rip),%rsi
cmove  %rax,%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x9,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"TEST1:OK\0A\00"
@.str.1 = [8 x i8] c"FAILED\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @fork()
store i32 %8, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %2
br label %21
11: ; preds = %2
%12 = call i32 (i32*, ...) bitcast (i32 (...)* @wait to i32 (i32*, ...)*)(i32* %7)
br label %13
13: ; preds = %11
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, 9
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %10
ret i32 9
}

LLVM IR (-O2):
@.str = [10 x i8] c"TEST1:OK\0A\00"
@.str.1 = [8 x i8] c"FAILED\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (...) @fork()
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = call i32 (i32*, ...) bitcast (i32 (...)* @wait to i32 (i32*, ...)*)(i32* %3)
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 9
%11 = select i1 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%12 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* %11)
br label %13
13: ; preds = %7, %2
ret i32 9
}
/* Type definitions */
typedef int /*<<< orphan*/ opt;

/* Variables and functions */
int /*<<< orphan*/ IP_TOS;
int /*<<< orphan*/ SOL_IP;
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                      unsigned int *, int);
int os_set_tos(int fd, int tos) {
  unsigned int opt = tos;
  return (0 == setsockopt(fd, SOL_IP, IP_TOS, &opt, sizeof(opt)));
}


x86 assembly (clang, -O0):
<os_set_tos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eca(%rip),%rax
mov    (%rax),%esi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_set_tos>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2edc(%rip),%rax
mov    (%rax),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOL_IP = global i32 0
@IP_TOS = global i32 0
define i32 @os_set_tos(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
store i32 %6, i32* %5
%7 = load i32, i32* %3
%8 = load i32, i32* @SOL_IP
%9 = load i32, i32* @IP_TOS
%10 = call i64 @setsockopt(i32 %7, i32 %8, i32 %9, i32* %5, i32 4)
%11 = icmp eq i64 0, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@SOL_IP = global i32 0
@IP_TOS = global i32 0
define i32 @os_set_tos(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 %1, i32* %3
%5 = load i32, i32* @SOL_IP
%6 = load i32, i32* @IP_TOS
%7 = call i64 @setsockopt(i32 %0, i32 %5, i32 %6, i32* %3, i32 4)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
int test_imm_94uint8_mem(unsigned char *val) {
  return ((*val) & (0x94 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_94uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 148
%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_94uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -108
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *fgets(char *, int, int /*<<< orphan*/ *);
char *test_gets(char *s, int size, FILE *f) { return fgets(s, size, f); }


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

x86 assembly (clang, -O2):
<test_gets>:
jmp    1030 <fgets@plt>

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

LLVM IR (-O2):
define i8* @test_gets(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i8* @fgets(i8* %0, i32 %1, i32* %2)
ret i8* %4
}
int priority(char x) {
  switch (x) {
  case '(':
    return 0;
  case '+':
  case '-':
    return 1;
  case '/':
  case '*':
  case '%':
    return 2;
  case '^':
    return 3;
  default:
    return 4;
  }
}


x86 assembly (clang, -O0):
<priority>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x39,%eax
ja     1164 <priority+0x64>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    116b <priority+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    116b <priority+0x6b>
movl   $0x2,-0x4(%rbp)
jmp    116b <priority+0x6b>
movl   $0x3,-0x4(%rbp)
jmp    116b <priority+0x6b>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<priority>:
add    $0xffffffdb,%edi
cmp    $0x39,%edi
ja     1126 <priority+0x26>
xor    %eax,%eax
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x2,%eax
ret
mov    $0x1,%eax
ret
mov    $0x4,%eax
ret
mov    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @priority(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 40, label %6
i32 43, label %7
i32 45, label %7
i32 47, label %8
i32 42, label %8
i32 37, label %8
i32 94, label %9
]
6: ; preds = %1
store i32 0, i32* %2
br label %11
7: ; preds = %1, %1
store i32 1, i32* %2
br label %11
8: ; preds = %1, %1, %1
store i32 2, i32* %2
br label %11
9: ; preds = %1
store i32 3, i32* %2
br label %11
10: ; preds = %1
store i32 4, i32* %2
br label %11
11: ; preds = %10, %9, %8, %7, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @priority(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %6 [
i32 40, label %7
i32 43, label %3
i32 45, label %3
i32 47, label %4
i32 42, label %4
i32 37, label %4
i32 94, label %5
]
3: ; preds = %1, %1
br label %7
4: ; preds = %1, %1, %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3
%8 = phi i32 [ 4, %6 ], [ 3, %5 ], [ 2, %4 ], [ 1, %3 ], [ 0, %1 ]
ret i32 %8
}
void yaml_get_version(int *major, int *minor, int *patch) {
  *major = 0;
  *minor = 1;
  *patch = 2;
}


x86 assembly (clang, -O0):
<yaml_get_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaml_get_version>:
movl   $0x0,(%rdi)
movl   $0x1,(%rsi)
movl   $0x2,(%rdx)
ret

LLVM IR (-O0):
define void @yaml_get_version(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
store i32 0, i32* %7
%8 = load i32*, i32** %5
store i32 1, i32* %8
%9 = load i32*, i32** %6
store i32 2, i32* %9
ret void
}

LLVM IR (-O2):
define void @yaml_get_version(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 0, i32* %0
store i32 1, i32* %1
store i32 2, i32* %2
ret void
}
/* Type definitions */
struct cbp_seq {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
struct cbp_seq *cbp_seq_init_range(int /*<<< orphan*/, char *, char *,
                                   int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
struct cbp_seq *cbp_seq_init(int32_t id, char *name, char *residues) {
  return cbp_seq_init_range(id, name, residues, 0, strlen(residues));
}


x86 assembly (clang, -O0):
<cbp_seq_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %eax,%r8d
xor    %ecx,%ecx
call   1040 <cbp_seq_init_range@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbp_seq_init>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %ecx,%ecx
mov    %eax,%r8d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <cbp_seq_init_range@plt>

LLVM IR (-O0):
%struct.cbp_seq = type { i32 }
define %struct.cbp_seq* @cbp_seq_init(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = call %struct.cbp_seq* @cbp_seq_init_range(i32 %7, i8* %8, i8* %9, i32 0, i32 %11)
ret %struct.cbp_seq* %12
}

LLVM IR (-O2):
%struct.cbp_seq = type { i32 }
define %struct.cbp_seq* @cbp_seq_init(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %2)
%5 = tail call %struct.cbp_seq* @cbp_seq_init_range(i32 %0, i8* %1, i8* %2, i32 0, i32 %4)
ret %struct.cbp_seq* %5
}
/* Variables and functions */
int /*<<< orphan*/ dpu_start();
int main() {
  dpu_start();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @dpu_start()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ message(int, char *);
void argerror(void) { message((4 | 2 | 1), "bad dimension\n"); }


x86 assembly (clang, -O0):
<argerror>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
lea    0xee0(%rip),%rsi
call   1030 <message@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"bad dimension\0A\00"
define void @argerror() {
%1 = call i32 @message(i32 7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"bad dimension\0A\00"
define void @argerror() {
%1 = tail call i32 @message(i32 7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(int /*<<< orphan*/);
void rdar8269537() { printf(0); }


x86 assembly (clang, -O0):
<rdar8269537>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rdar8269537() {
%1 = call i32 @printf(i32 0)
ret void
}

LLVM IR (-O2):
define void @rdar8269537() {
%1 = tail call i32 @printf(i32 0)
ret void
}
char HCarry(char A, char B) { return (char)(A && B); }


x86 assembly (clang, -O0):
<HCarry>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x3(%rbp)
je     112f <HCarry+0x2f>
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HCarry>:
test   %dil,%dil
setne  %cl
test   %sil,%sil
setne  %al
and    %cl,%al
ret

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

LLVM IR (-O2):
define signext i8 @HCarry(i8 signext %0, i8 signext %1) {
%3 = icmp ne i8 %0, 0
%4 = icmp ne i8 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i8
ret i8 %6
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t gf2_matrix_times(uint64_t *mat, uint64_t vec) {
  uint64_t sum;
  sum = 0;
  while (vec) {
    if (vec & 1)
      sum ^= *mat;
    vec >>= 1;
    mat++;
  }
  return sum;
}


x86 assembly (clang, -O0):
<gf2_matrix_times>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1151 <gf2_matrix_times+0x51>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1137 <gf2_matrix_times+0x37>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    1112 <gf2_matrix_times+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf2_matrix_times>:
xor    %eax,%eax
test   %esi,%esi
jne    111f <gf2_matrix_times+0x1f>
ret
nopw   0x0(%rax,%rax,1)
mov    %esi,%ecx
sar    %ecx
add    $0x4,%rdi
cmp    $0x1,%esi
mov    %ecx,%esi
jbe    1106 <gf2_matrix_times+0x6>
test   $0x1,%sil
je     1110 <gf2_matrix_times+0x10>
xor    (%rdi),%eax
jmp    1110 <gf2_matrix_times+0x10>

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

LLVM IR (-O2):
define i32 @gf2_matrix_times(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %13
%5 = phi i32 [ %14, %13 ], [ 0, %2 ]
%6 = phi i32 [ %15, %13 ], [ %1, %2 ]
%7 = phi i32* [ %16, %13 ], [ %0, %2 ]
%8 = and i32 %6, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = load i32, i32* %7
%12 = xor i32 %11, %5
br label %13
13: ; preds = %10, %4
%14 = phi i32 [ %12, %10 ], [ %5, %4 ]
%15 = ashr i32 %6, 1
%16 = getelementptr inbounds i32, i32* %7, i64 1
%17 = icmp ult i32 %6, 2
br i1 %17, label %18, label %4
18: ; preds = %13, %2
%19 = phi i32 [ 0, %2 ], [ %14, %13 ]
ret i32 %19
}
void rop3_16_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | S;
  stk2 = ~stk2;
  stk1 = T & stk2;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_16_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_16_0_0>:
or     (%rdi),%sil
not    %sil
and    %dl,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_16_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = and i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = load i8*, i8** %4
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @rop3_16_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = xor i8 %5, -1
%7 = and i8 %6, %2
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int sys_mknod(char *, int, int);
int main(void) {
  if (sizeof(int) < 4)
    exit(0);
  return sys_mknod("test", 1, 0x12345678);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x1,%esi
mov    $0x12345678,%edx
call   1030 <sys_mknod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
mov    $0x12345678,%edx
jmp    1030 <sys_mknod@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sys_mknod(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1, i32 305419896)
ret i32 %2
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i32 @main() {
%1 = tail call i32 @sys_mknod(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1, i32 305419896)
ret i32 %1
}
/* Variables and functions */
int _ioctl(int, char, int);
int tcdrain(int fd) { return _ioctl(fd, (('T' << 8) | 5), 1); }


x86 assembly (clang, -O0):
<tcdrain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <_ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcdrain>:
mov    $0x5,%esi
mov    $0x1,%edx
jmp    1030 <_ioctl@plt>

LLVM IR (-O0):
define i32 @tcdrain(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_ioctl(i32 %3, i8 signext 5, i32 1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @tcdrain(i32 %0) {
%2 = tail call i32 @_ioctl(i32 %0, i8 signext 5, i32 1)
ret i32 %2
}