xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint16_t;
struct dictionary {
  int dummy;
};

/* Variables and functions */
scalar_t__ dict_find(int /*<<< orphan*/ const *, size_t,
                     struct dictionary const *);
uint16_t lookup_replacement(uint16_t original, const uint8_t *replacement,
                            size_t replen,
                            const struct dictionary *dictionary) {
  uint16_t d;
  d = dict_find(replacement, replen, dictionary);
  if (d == 0)
    return original;
  return d;
}


x86 assembly (clang, -O0):
<lookup_replacement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <dict_find@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1155 <lookup_replacement+0x45>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115d <lookup_replacement+0x4d>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup_replacement>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <dict_find@plt>
test   %rax,%rax
cmove  %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.dictionary = type { i32 }
define i64 @lookup_replacement(i64 %0, i32* %1, i64 %2, %struct.dictionary* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i64
%9 = alloca %struct.dictionary*
%10 = alloca i64
store i64 %0, i64* %6
store i32* %1, i32** %7
store i64 %2, i64* %8
store %struct.dictionary* %3, %struct.dictionary** %9
%11 = load i32*, i32** %7
%12 = load i64, i64* %8
%13 = load %struct.dictionary*, %struct.dictionary** %9
%14 = call i64 @dict_find(i32* %11, i64 %12, %struct.dictionary* %13)
store i64 %14, i64* %10
%15 = load i64, i64* %10
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %4
%18 = load i64, i64* %6
store i64 %18, i64* %5
br label %21
19: ; preds = %4
%20 = load i64, i64* %10
store i64 %20, i64* %5
br label %21
21: ; preds = %19, %17
%22 = load i64, i64* %5
ret i64 %22
}

LLVM IR (-O2):
%struct.dictionary = type { i32 }
define i64 @lookup_replacement(i64 %0, i32* %1, i64 %2, %struct.dictionary* %3) {
%5 = tail call i64 @dict_find(i32* %1, i64 %2, %struct.dictionary* %3)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i64 %0, i64 %5
ret i64 %7
}
void rop3_48_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~S;
  stk1 = T & stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


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

x86 assembly (clang, -O2):
<rop3_48_1_1>:
or     %edx,%esi
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_48_1_1(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* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = and i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = xor i32 %22, -1
%24 = and i32 %20, %23
%25 = load i8, i8* %6
%26 = zext i8 %25 to i32
%27 = xor i32 %26, -1
%28 = and i32 %24, %27
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = and i32 %31, %33
%35 = or i32 %28, %34
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = and i32 %38, %40
%42 = or i32 %35, %41
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
store i8 %43, i8* %44
ret void
}

LLVM IR (-O2):
define void @rop3_48_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = and i8 %4, %5
store i8 %6, i8* %0
ret void
}
int distanciaCorrida(int inicio, int fim) { return fim - inicio; }


x86 assembly (clang, -O0):
<distanciaCorrida>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @distanciaCorrida(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @distanciaCorrida(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
ret i32 %3
}
int ft_abs(int nb) {
  if (nb < 0)
    return (-1 * nb);
  return (nb);
}


x86 assembly (clang, -O0):
<ft_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1120 <ft_abs+0x20>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <ft_abs+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ft_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int vetor(int n, int v[]) {
  if (n == 1)
    return v[0];
  else {
    int x;
    x = vetor(n - 1, v);
    if (x > v[n - 1])
      return x;
    else
      return v[n - 1];
  }
}


x86 assembly (clang, -O0):
<vetor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1137 <vetor+0x27>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <vetor+0x70>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <vetor@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    116d <vetor+0x5d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <vetor+0x70>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vetor>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x1,%edi
jne    1121 <vetor+0x11>
mov    (%r14),%eax
jmp    113d <vetor+0x2d>
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
mov    %r14,%rsi
call   1030 <vetor@plt>
mov    %eax,%ecx
movslq %ebx,%rax
mov    -0x4(%r14,%rax,4),%eax
cmp    %eax,%ecx
cmovg  %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @vetor(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 = icmp eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
store i32 %12, i32* %3
br label %35
13: ; preds = %2
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = load i32*, i32** %5
%17 = call i32 @vetor(i32 %15, i32* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = load i32*, i32** %5
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %19, i64 %22
%24 = load i32, i32* %23
%25 = icmp sgt i32 %18, %24
br i1 %25, label %26, label %28
26: ; preds = %13
%27 = load i32, i32* %6
store i32 %27, i32* %3
br label %35
28: ; preds = %13
%29 = load i32*, i32** %5
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
%34 = load i32, i32* %33
store i32 %34, i32* %3
br label %35
35: ; preds = %28, %26, %9
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @vetor(i32 %0, i32* nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* %1
br label %6
6: ; preds = %4, %8
%7 = phi i32 [ %15, %8 ], [ %5, %4 ]
ret i32 %7
8: ; preds = %2
%9 = add nsw i32 %0, -1
%10 = tail call i32 @vetor(i32 %9, i32* %1)
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = load i32, i32* %12
%14 = icmp sgt i32 %10, %13
%15 = select i1 %14, i32 %10, i32 %13
br label %6
}
/* Variables and functions */
int /*<<< orphan*/ foo();
void test_private() {
  int i;
#pragma omp parallel
#pragma omp single private(
  foo();
#pragma omp parallel
#pragma omp single private(,
  foo();
#pragma omp parallel
#pragma omp single private(, )
  foo();
#pragma omp parallel
#pragma omp single private()
  foo();
#pragma omp parallel
#pragma omp single private(int)
  foo();
#pragma omp parallel
#pragma omp single private(0)
  foo();
  int x, y, z;
#pragma omp parallel
#pragma omp single private(x)
  foo();
#pragma omp parallel
#pragma omp single private(x, y)
  foo();
#pragma omp parallel
#pragma omp single private(x, y, z)
  foo();
}


x86 assembly (clang, -O0):
<test_private>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_private>:
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @test_private() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @foo()
%6 = call i32 (...) @foo()
%7 = call i32 (...) @foo()
%8 = call i32 (...) @foo()
%9 = call i32 (...) @foo()
%10 = call i32 (...) @foo()
%11 = call i32 (...) @foo()
%12 = call i32 (...) @foo()
%13 = call i32 (...) @foo()
ret void
}

LLVM IR (-O2):
define void @test_private() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
%4 = tail call i32 (...) @foo()
%5 = tail call i32 (...) @foo()
%6 = tail call i32 (...) @foo()
%7 = tail call i32 (...) @foo()
%8 = tail call i32 (...) @foo()
%9 = tail call i32 (...) @foo()
ret void
}
/* Variables and functions */
scalar_t__ istty();
char *rdz_bl() { return istty() ? "[1;34m" : ""; }


x86 assembly (clang, -O0):
<rdz_bl>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <istty@plt>
mov    %rax,%rdx
lea    0xee2(%rip),%rax
lea    0xed4(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdz_bl>:
push   %rax
xor    %eax,%eax
call   1030 <istty@plt>
test   %rax,%rax
lea    0xee5(%rip),%rcx
lea    0xed7(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[1;34m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @rdz_bl() {
%1 = call i64 (...) @istty()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
ret i8* %4
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[1;34m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @rdz_bl() {
%1 = tail call i64 (...) @istty()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
scalar_t__ annee_est_bissextile(int);
int jours_par_an(int annee) { return annee_est_bissextile(annee) ? 366 : 365; }


x86 assembly (clang, -O0):
<jours_par_an>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <annee_est_bissextile@plt>
mov    %rax,%rdx
mov    $0x16d,%eax
mov    $0x16e,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jours_par_an>:
push   %rax
call   1030 <annee_est_bissextile@plt>
cmp    $0x1,%rax
mov    $0x16e,%eax
sbb    $0x0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @jours_par_an(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @annee_est_bissextile(i32 %3)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 366, i32 365
ret i32 %7
}

LLVM IR (-O2):
define i32 @jours_par_an(i32 %0) {
%2 = tail call i64 @annee_est_bissextile(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 365, i32 366
ret i32 %4
}
/* Variables and functions */
bool nrf52_errata_119(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_119() {
ret i32 0
}
int execute_futex() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_futex() {
ret i32 0
}
I0AX1(r0, r1, x0, x1, p0, p1) signed char r0, r1;
signed char *p0, *p1;
{
  if (22 <= (((signed char *)11111111)[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<I0AX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    $0xa98ac7,%eax
movsbl (%rax,%rcx,1),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     1144 <I0AX1+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <I0AX1+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I0AX1>:
movslq %ecx,%rcx
xor    %eax,%eax
cmpb   $0x16,0xa98ac7(%rcx)
setge  %al
ret

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

LLVM IR (-O2):
define i32 @I0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i8, i8* inttoptr (i64 11111111 to i8*), i64 %7
%9 = load i8, i8* %8
%10 = icmp sgt i8 %9, 21
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ test2_g();
void test2_h(void) { test2_g(); }


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

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

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

LLVM IR (-O2):
define void @test2_h() {
%1 = tail call i32 (...) @test2_g()
ret void
}
int main() {
  char str[] = {
      'a',
      'b',
      'c',
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0xeee(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xee6(%rip),%al
mov    %al,-0x5(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.str = [3 x i8] c"abc"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
store i32 0, i32* %1
%3 = bitcast [3 x i8]* %2 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ MSG(char *, char const *);
void CUI_report_suite_start(const char *suite_name) {
  MSG("Suite %s\n", suite_name);
}


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

x86 assembly (clang, -O2):
<CUI_report_suite_start>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <MSG@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Suite %s\0A\00"
define void @CUI_report_suite_start(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @MSG(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Suite %s\0A\00"
define void @CUI_report_suite_start(i8* %0) {
%2 = tail call i32 @MSG(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int divisible_by_base2(int number, int divisor) {
  if ((number & (divisor - 1)) == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<divisible_by_base2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    112a <divisible_by_base2+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1131 <divisible_by_base2+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisible_by_base2>:
add    $0xffffffff,%esi
xor    %eax,%eax
test   %edi,%esi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @divisible_by_base2(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = and i32 %3, %0
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
int decode_varint_old(const char *src, int *len) {
  int n = -*src;
  *len = 1;
  if (n >= 64) {
    n -= 64;
    n += (*(unsigned char *)(src + 1)) << 6;
    *len = 2;
  }
  return n;
}


x86 assembly (clang, -O0):
<decode_varint_old>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x40,-0x14(%rbp)
jl     1152 <decode_varint_old+0x52>
mov    -0x14(%rbp),%eax
sub    $0x40,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x6,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_varint_old>:
movsbl (%rdi),%eax
movl   $0x1,(%rsi)
cmp    $0xffffffc0,%eax
jg     1123 <decode_varint_old+0x23>
movzbl 0x1(%rdi),%ecx
shl    $0x6,%ecx
sub    %eax,%ecx
add    $0xffffffc0,%ecx
movl   $0x2,(%rsi)
mov    %ecx,%eax
ret
neg    %eax
ret

LLVM IR (-O0):
define i32 @decode_varint_old(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = sub nsw i32 0, %8
store i32 %9, i32* %5
%10 = load i32*, i32** %4
store i32 1, i32* %10
%11 = load i32, i32* %5
%12 = icmp sge i32 %11, 64
br i1 %12, label %13, label %24
13: ; preds = %2
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 64
store i32 %15, i32* %5
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 6
%21 = load i32, i32* %5
%22 = add nsw i32 %21, %20
store i32 %22, i32* %5
%23 = load i32*, i32** %4
store i32 2, i32* %23
br label %24
24: ; preds = %13, %2
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
define i32 @decode_varint_old(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = sub nsw i32 0, %4
store i32 1, i32* %1
%6 = icmp slt i8 %3, -63
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = sub nsw i32 -64, %4
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 6
%13 = add nsw i32 %8, %12
store i32 2, i32* %1
br label %14
14: ; preds = %7, %2
%15 = phi i32 [ %13, %7 ], [ %5, %2 ]
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ setjmp(int /*<<< orphan*/);
int /*<<< orphan*/ tst1();
void tst2(void) {
  jmp_buf jmp;
  setjmp(jmp);
  int i, a[2], b[2];
  for (i = 0; i < 2; i++)
    a[i] = 0;
  for (i = 0; i < 2; i++)
    b[i] = 0;
  tst1();
}


x86 assembly (clang, -O0):
<tst2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x4(%rbp),%edi
call   1040 <setjmp@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115b <tst2+0x3b>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x10(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1137 <tst2+0x17>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1186 <tst2+0x66>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x18(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <tst2+0x42>
mov    $0x0,%al
call   1030 <tst1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst2>:
push   %rax
call   1040 <setjmp@plt>
xor    %eax,%eax
call   1030 <tst1@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @tst2() {
%1 = call i32 @setjmp(i32 undef)
%2 = call i32 (...) @tst1()
ret void
}
/* Variables and functions */
int write(int, unsigned char *, int);
int SendBuf(int comport_number, unsigned char *buf, int size) {
  return (write(comport_number, buf, size));
}


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

x86 assembly (clang, -O2):
<SendBuf>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @SendBuf(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int partition(int *, int, int);
void quick_sort(int *a, int start, int end) {
  int pindex;
  if (start < end) {
    pindex = partition(a, start, end);
    quick_sort(a, start, pindex - 1);
    quick_sort(a, pindex + 1, end);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int shlibfunc2();
int statlibfunc();
int main(int argc, char **argv) {
  if (statlibfunc() != 42)
    return 1;
  if (shlibfunc2() != 24)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <statlibfunc@plt>
cmp    $0x2a,%eax
je     1152 <main+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1175 <main+0x55>
mov    $0x0,%al
call   1040 <shlibfunc2@plt>
cmp    $0x18,%eax
je     116e <main+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1175 <main+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <statlibfunc@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x2a,%ecx
jne    1145 <main+0x25>
xor    %eax,%eax
call   1040 <shlibfunc2@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x18,%ecx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @statlibfunc()
%7 = icmp ne i32 %6, 42
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %14
9: ; preds = %2
%10 = call i32 (...) @shlibfunc2()
%11 = icmp ne i32 %10, 24
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 1, i32* %3
br label %14
13: ; preds = %9
store i32 0, i32* %3
br label %14
14: ; preds = %13, %12, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @statlibfunc()
%4 = icmp eq i32 %3, 42
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 (...) @shlibfunc2()
%7 = icmp ne i32 %6, 24
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ 1, %2 ], [ %8, %5 ]
ret i32 %10
}
int f3(int y, int x) { return (y & (~x)) | x; }


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
or     -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f3(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %6, -1
%8 = and i32 %5, %7
%9 = load i32, i32* %4
%10 = or i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @f3(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int ENOSYS;
int pthread_rwlock_init(pthread_rwlock_t *rwlock,
                        const pthread_rwlockattr_t *attr) {
  return -ENOSYS;
}


x86 assembly (clang, -O0):
<pthread_rwlock_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ed3(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_rwlock_init>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @pthread_rwlock_init(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOSYS
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @pthread_rwlock_init(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SetFGColor81(unsigned long);
void setfgcolor(unsigned long c) { SetFGColor81(c); }


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

x86 assembly (clang, -O2):
<setfgcolor>:
jmp    1030 <SetFGColor81@plt>

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

LLVM IR (-O2):
define void @setfgcolor(i64 %0) {
%2 = tail call i32 @SetFGColor81(i64 %0)
ret void
}
/* Variables and functions */
double nearbyint(double);
double test5(double x) { return nearbyint(x); }


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

x86 assembly (clang, -O2):
<test5>:
jmp    1030 <nearbyint@plt>

LLVM IR (-O0):
define double @test5(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.nearbyint.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @test5(double %0) {
%2 = tail call double @llvm.nearbyint.f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ getpagesize();
size_t GetPageSize() { return (size_t)getpagesize(); }


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

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

LLVM IR (-O0):
define i64 @GetPageSize() {
%1 = call i32 (...) @getpagesize()
%2 = sext i32 %1 to i64
ret i64 %2
}

LLVM IR (-O2):
define i64 @GetPageSize() {
%1 = tail call i32 (...) @getpagesize()
%2 = sext i32 %1 to i64
ret i64 %2
}
/* Type definitions */
typedef int __u64;
typedef int __u32;

/* Variables and functions */
int fls(int);
int fls64(__u64 x) {
  __u32 h = x >> 32;
  if (h)
    return fls(h) + 32;
  return fls(x);
}


x86 assembly (clang, -O0):
<fls64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1145 <fls64+0x35>
mov    -0xc(%rbp),%edi
call   1030 <fls@plt>
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <fls64+0x40>
mov    -0x8(%rbp),%edi
call   1030 <fls@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fls64>:
jmp    1030 <fls@plt>

LLVM IR (-O0):
define i32 @fls64(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* %4
%11 = call i32 @fls(i32 %10)
%12 = add nsw i32 %11, 32
store i32 %12, i32* %2
br label %16
13: ; preds = %1
%14 = load i32, i32* %3
%15 = call i32 @fls(i32 %14)
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @fls64(i32 %0) {
%2 = tail call i32 @fls(i32 %0)
ret i32 %2
}
void ff_hevc_put_hevc_uni_pel_pixels4_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_pel_pixels4_12_sse4() {
ret void
}
int test_foo(int foo) { return foo; }


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

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

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

LLVM IR (-O2):
define i32 @test_foo(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
unsigned char NsmcInit(void) {
  printf("NSMC: NsmcInit called.\n");
  return 1;
}


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

x86 assembly (clang, -O2):
<NsmcInit>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%al
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [23 x i8] c"NSMC: NsmcInit called.\00"
define zeroext i8 @NsmcInit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret i8 1
}
void bar_short(short *x) { *x = __real foo_short(5); }


x86 assembly (clang, -O0):
<bar_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x5,%edi
mov    $0x0,%al
call   1030 <foo_short@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar_short>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5,%edi
xor    %eax,%eax
call   1030 <foo_short@plt>
mov    %ax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @bar_short(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @foo_short to i32 (i32, ...)*)(i32 5)
%4 = trunc i32 %3 to i16
%5 = load i16*, i16** %2
store i16 %4, i16* %5
ret void
}

LLVM IR (-O2):
define void @bar_short(i16* nocapture writeonly %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @foo_short to i32 (i32, ...)*)(i32 5)
%3 = trunc i32 %2 to i16
store i16 %3, i16* %0
ret void
}
void foo_1_2_2_2_1_1_1_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_2_1_1_1_1_1() {
ret void
}
int okn_tsm_mtx4(struct okn_tsm *t, struct okn_mtx4 *mtx) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.okn_tsm = type opaque
%struct.okn_mtx4 = type opaque
define i32 @okn_tsm_mtx4(%struct.okn_tsm* nocapture readnone %0, %struct.okn_mtx4* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
char *fc_real_malloc(scalar_t__, char const *, int, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *real_fc_strdup(const char *str, const char *called_as, int line,
                     const char *file) {
  char *dest = fc_real_malloc(strlen(str) + 1, called_as, line, file);
  strcpy(dest, str);
  return dest;
}


x86 assembly (clang, -O0):
<real_fc_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1050 <fc_real_malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<real_fc_strdup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
call   1050 <fc_real_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @real_fc_strdup(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = add nsw i64 %11, 1
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = load i8*, i8** %8
%16 = call i8* @fc_real_malloc(i64 %12, i8* %13, i32 %14, i8* %15)
store i8* %16, i8** %9
%17 = load i8*, i8** %9
%18 = load i8*, i8** %5
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = load i8*, i8** %9
ret i8* %20
}

LLVM IR (-O2):
define i8* @real_fc_strdup(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add nsw i64 %5, 1
%7 = tail call i8* @fc_real_malloc(i64 %6, i8* %1, i32 %2, i8* %3)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
ret i8* %7
}
int irmo_pointer_equal(void *location1, void *location2) {
  return location1 == location2;
}


x86 assembly (clang, -O0):
<irmo_pointer_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<irmo_pointer_equal>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @irmo_pointer_equal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @irmo_pointer_equal(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int _is_value_set(const char *value) {
  if (NULL == value || '\0' == *value) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_is_value_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1125 <_is_value_set+0x25>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1131 <_is_value_set+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1138 <_is_value_set+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_value_set>:
test   %rdi,%rdi
je     110b <_is_value_set+0xb>
cmpb   $0x1,(%rdi)
sbb    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @_is_value_set(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* null, %4
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 0, %9
br i1 %10, label %11, label %12
11: ; preds = %6, %1
store i32 -1, i32* %2
br label %13
12: ; preds = %6
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @_is_value_set(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
%6 = sext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ -1, %1 ], [ %6, %3 ]
ret i32 %8
}
__attribute__((no, noclone)) signed __int128 t101_2add(signed __int128 y) {
  signed __int128 x =
      (((signed __int128)(((unsigned __int128)1 << (16 * 8 - 1)) - 1)));
  signed __int128 r;
  if (__builtin_add_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t101_2add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x38(%rbp)
movq   $0xffffffffffffffff,-0x40(%rbp)
ff
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rax
add    %rsi,%rdx
adc    %rax,%rcx
seto   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    1174 <t101_2add+0x64>
jmp    117b <t101_2add+0x6b>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t101_2add>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0xffffffffffffffff,%r14
movabs $0x7fffffffffffffff,%rbx
ff ff 7f
adc    %rsi,%rbx
jno    1131 <t101_2add+0x21>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t101_2add(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 170141183460469231731687303715884105727, i128* %6
%12 = load i128, i128* %6
%13 = load i128, i128* %5
%14 = call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %12, i128 %13)
%15 = extractvalue { i128, i1 } %14, 1
%16 = extractvalue { i128, i1 } %14, 0
store i128 %16, i128* %7
br i1 %15, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %2
%20 = load i128, i128* %7
store i128 %20, i128* %3
%21 = bitcast i128* %3 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t101_2add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %6, i128 170141183460469231731687303715884105727)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t byte_odd(const uint8_t byte) { return byte & 1; }


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

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

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

LLVM IR (-O2):
define i32 @byte_odd(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int check_signature(char const *, char **);
int is_signature_sql_injection(const char *input) {
  char *signatures[] = {"([0-9] | ' | \")?([+])(OR | AND)([+])[0-9]*[0-9]"};
  return check_signature(input, signatures);
}


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

x86 assembly (clang, -O2):
<is_signature_sql_injection>:
push   %rax
lea    0xee8(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rsi
call   1030 <check_signature@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"([0-9] | ' | \22)?([+])(OR | AND)([+])[0-9]*[0-9]\00"
@__const.is_signature_sql_injection.signatures = [1 x i8*] [i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i32 0, i32 0)]
define i32 @is_signature_sql_injection(i8* %0) {
%2 = alloca i8*
%3 = alloca [1 x i8*]
store i8* %0, i8** %2
%4 = bitcast [1 x i8*]* %3 to i8*
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [1 x i8*], [1 x i8*]* %3, i64 0, i64 0
%7 = call i32 @check_signature(i8* %5, i8** %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [48 x i8] c"([0-9] | ' | \22)?([+])(OR | AND)([+])[0-9]*[0-9]\00"
define i32 @is_signature_sql_injection(i8* %0) {
%2 = alloca [1 x i8*]
%3 = bitcast [1 x i8*]* %2 to i8*
%4 = bitcast [1 x i8*]* %2 to i64*
store i64 ptrtoint ([48 x i8]* @.str to i64), i64* %4
%5 = getelementptr inbounds [1 x i8*], [1 x i8*]* %2, i64 0, i64 0
%6 = call i32 @check_signature(i8* %0, i8** %5)
ret i32 %6
}