xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  int j;
  i = 0;
  j = 1;
  while (i < 5) {
    i = i + j;
  }
  assert(j == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1145 <main+0x35>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ initializeSemsAndMutexInt();
void initializeProdCons() { initializeSemsAndMutexInt(); }


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

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

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

LLVM IR (-O2):
define void @initializeProdCons() {
%1 = tail call i32 (...) @initializeSemsAndMutexInt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TIOCGWINSZ;
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  printf("0x%lx\n", TIOCGWINSZ);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"0x%lx\0A\00"
@TIOCGWINSZ = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @TIOCGWINSZ
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"0x%lx\0A\00"
@TIOCGWINSZ = global i32 0
define i32 @main() {
%1 = load i32, i32* @TIOCGWINSZ
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("./hpx84-connector <file.hpgl>\n");
  printf("\t -d device : set different port\n");
  printf("\t reads from stdin if no file given\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"./hpx84-connector <file.hpgl>\0A\00"
@.str.1 = [34 x i8] c"\09 -d device : set different port\0A\00"
@.str.2 = [37 x i8] c"\09 reads from stdin if no file given\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"./hpx84-connector <file.hpgl>\00"
@str.3 = [33 x i8] c"\09 -d device : set different port\00"
@str.4 = [36 x i8] c"\09 reads from stdin if no file given\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Type definitions */
struct filepirate {
  int dummy;
};

/* Variables and functions */
scalar_t__ get_ptr(struct filepirate *, uintptr_t);
void write_uint(struct filepirate *fp, uintptr_t index, unsigned int val) {
  *((unsigned int *)(get_ptr(fp, index))) = val;
}


x86 assembly (clang, -O0):
<write_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <get_ptr@plt>
mov    -0x18(%rbp),%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_uint>:
push   %rbx
mov    %edx,%ebx
call   1030 <get_ptr@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
%struct.filepirate = type { i32 }
define void @write_uint(%struct.filepirate* %0, i64 %1, i32 %2) {
%4 = alloca %struct.filepirate*
%5 = alloca i64
%6 = alloca i32
store %struct.filepirate* %0, %struct.filepirate** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load %struct.filepirate*, %struct.filepirate** %4
%9 = load i64, i64* %5
%10 = call i64 @get_ptr(%struct.filepirate* %8, i64 %9)
%11 = inttoptr i64 %10 to i32*
store i32 %7, i32* %11
ret void
}

LLVM IR (-O2):
%struct.filepirate = type { i32 }
define void @write_uint(%struct.filepirate* %0, i64 %1, i32 %2) {
%4 = tail call i64 @get_ptr(%struct.filepirate* %0, i64 %1)
%5 = inttoptr i64 %4 to i32*
store i32 %2, i32* %5
ret void
}
int find_last_loop(char *commands, int count) {
  while (count != 0) {
    if (commands[count] == '[') {
      return count;
    }
    --count;
  }
  return -1;
}


x86 assembly (clang, -O0):
<find_last_loop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1143 <find_last_loop+0x43>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5b,%eax
jne    1135 <find_last_loop+0x35>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <find_last_loop+0x4a>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    110b <find_last_loop+0xb>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_last_loop>:
mov    $0xffffffff,%eax
test   %esi,%esi
je     111e <find_last_loop+0x1e>
movslq %esi,%rcx
add    %rcx,%rdi
nop
cmpb   $0x5b,(%rdi)
je     111f <find_last_loop+0x1f>
add    $0xffffffffffffffff,%rdi
add    $0xffffffff,%esi
jne    1110 <find_last_loop+0x10>
ret
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @find_last_loop(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = sext i32 %1 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ %5, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 91
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = add nsw i64 %7, -1
%13 = trunc i64 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %6
15: ; preds = %6
%16 = trunc i64 %7 to i32
br label %17
17: ; preds = %11, %15, %2
%18 = phi i32 [ -1, %2 ], [ %16, %15 ], [ -1, %11 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ MixerStatusHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void MixerStatusLogging() { UAVObjLogging(MixerStatusHandle()); }


x86 assembly (clang, -O0):
<MixerStatusLogging>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <MixerStatusHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjLogging@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MixerStatusLogging>:
push   %rax
xor    %eax,%eax
call   1040 <MixerStatusHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjLogging@plt>

LLVM IR (-O0):
define void @MixerStatusLogging() {
%1 = call i32 (...) @MixerStatusHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @MixerStatusLogging() {
%1 = tail call i32 (...) @MixerStatusHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
/* Variables and functions */
int anetReadWidthType(int, char *, int, int /*<<< orphan*/, int /*<<< orphan*/);
int catAnetNoBlockRead(int fd, char *buf, int count) {
  return anetReadWidthType(fd, buf, count, 0, 0);
}


x86 assembly (clang, -O0):
<catAnetNoBlockRead>:
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
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <anetReadWidthType@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catAnetNoBlockRead>:
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <anetReadWidthType@plt>

LLVM IR (-O0):
define i32 @catAnetNoBlockRead(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 @anetReadWidthType(i32 %7, i8* %8, i32 %9, i32 0, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @catAnetNoBlockRead(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @anetReadWidthType(i32 %0, i8* %1, i32 %2, i32 0, i32 0)
ret i32 %4
}
/* Variables and functions */
bool nrf52_errata_12(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_12() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *name) {
  printf("%s num-allocs block-size [step [min [max]]]\n", name);
  exit(EXIT_SUCCESS);
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"%s num-allocs block-size [step [min [max]]]\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_SUCCESS
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [45 x i8] c"%s num-allocs block-size [step [min [max]]]\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
long fat(long n) {
  if (n <= 1)
    return 1;
  else {
    return n * fat(n - 1);
  }
}


x86 assembly (clang, -O0):
<fat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jg     1134 <fat+0x24>
movq   $0x1,-0x8(%rbp)
jmp    1158 <fat+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fat@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fat>:
mov    $0x1,%eax
cmp    $0x2,%rdi
jl     1121 <fat+0x21>
mov    $0x1,%eax
imul   %rdi,%rax
lea    -0x1(%rdi),%rcx
cmp    $0x2,%rdi
mov    %rcx,%rdi
ja     1110 <fat+0x10>
ret

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

LLVM IR (-O2):
define i64 @fat(i64 %0) {
%2 = icmp slt i64 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ %0, %1 ]
%5 = phi i64 [ %7, %3 ], [ 1, %1 ]
%6 = add nsw i64 %4, -1
%7 = mul nsw i64 %4, %5
%8 = icmp ult i64 %4, 3
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i64 [ 1, %1 ], [ %7, %3 ]
ret i64 %10
}
/* Type definitions */
struct timeval {
  double tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
double time_to_double(struct timeval t) {
  return t.tv_sec + ((double)t.tv_usec / 1000000);
}


x86 assembly (clang, -O0):
<time_to_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdq -0x8(%rbp),%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_to_double>:
cvtsi2sd %rdi,%xmm1
divsd  0xef3(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, i64 }
define double @time_to_double(double %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to { double, i64 }*
%5 = getelementptr inbounds { double, i64 }, { double, i64 }* %4, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, i64 }, { double, i64 }* %4, i32 0, i32 1
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 1.000000e+06
%13 = fadd double %8, %12
ret double %13
}

LLVM IR (-O2):
define double @time_to_double(double %0, i64 %1) {
%3 = sitofp i64 %1 to double
%4 = fdiv double %3, 1.000000e+06
%5 = fadd double %4, %0
ret double %5
}
SP_CASE(imacro, imetamacro_drop) {
  int total =
      __ii_idx_i(0, 10, 300) + __ii_idx_i(1, 10, 400) + __ii_idx_i(2, 10, 500);
  SP_TRUE(total == 1233);
}


x86 assembly (clang, -O0):
<SP_CASE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %edi,%edi
mov    $0xa,%esi
mov    $0x12c,%edx
mov    $0x0,%al
call   1040 <__ii_idx_i@plt>
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x190,%edx
mov    $0x0,%al
call   1040 <__ii_idx_i@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
mov    $0xa,%esi
mov    $0x1f4,%edx
mov    $0x0,%al
call   1040 <__ii_idx_i@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x4d1,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <SP_TRUE@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SP_CASE>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
mov    $0xa,%esi
mov    $0x12c,%edx
xor    %eax,%eax
call   1040 <__ii_idx_i@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x190,%edx
xor    %eax,%eax
call   1040 <__ii_idx_i@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    $0x2,%edi
mov    $0xa,%esi
mov    $0x1f4,%edx
xor    %eax,%eax
call   1040 <__ii_idx_i@plt>
add    %ebp,%eax
xor    %edi,%edi
cmp    $0x4d1,%eax
sete   %dil
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <SP_TRUE@plt>

LLVM IR (-O0):
define i32 @SP_CASE(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 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @__ii_idx_i to i32 (i32, i32, i32, ...)*)(i32 0, i32 10, i32 300)
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @__ii_idx_i to i32 (i32, i32, i32, ...)*)(i32 1, i32 10, i32 400)
%9 = add nsw i32 %7, %8
%10 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @__ii_idx_i to i32 (i32, i32, i32, ...)*)(i32 2, i32 10, i32 500)
%11 = add nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 1233
%14 = zext i1 %13 to i32
%15 = call i32 (i32, ...) bitcast (i32 (...)* @SP_TRUE to i32 (i32, ...)*)(i32 %14)
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @SP_CASE(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @__ii_idx_i to i32 (i32, i32, i32, ...)*)(i32 0, i32 10, i32 300)
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @__ii_idx_i to i32 (i32, i32, i32, ...)*)(i32 1, i32 10, i32 400)
%5 = add nsw i32 %4, %3
%6 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @__ii_idx_i to i32 (i32, i32, i32, ...)*)(i32 2, i32 10, i32 500)
%7 = add nsw i32 %5, %6
%8 = icmp eq i32 %7, 1233
%9 = zext i1 %8 to i32
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @SP_TRUE to i32 (i32, ...)*)(i32 %9)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, int);
void get_resource_name(char *data, char *buf) {
  strncpy(buf, data + 4, 8);
  buf[8] = 0;
  return;
}


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

x86 assembly (clang, -O2):
<get_resource_name>:
push   %rbx
mov    %rsi,%rbx
lea    0x4(%rdi),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x8(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @get_resource_name(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
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 4
%8 = call i32 @strncpy(i8* %5, i8* %7, i32 8)
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 8
store i8 0, i8* %10
ret void
}

LLVM IR (-O2):
define void @get_resource_name(i8* %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = tail call i32 @strncpy(i8* %1, i8* %3, i32 8)
%5 = getelementptr inbounds i8, i8* %1, i64 8
store i8 0, i8* %5
ret void
}
void main() {
  int a;
  a = 4;
}


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

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 4, i32* %1
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
int f() {
  static char *gender[] = {"male", "female", "?"};
  if (*gender[1] == *gender[2])
    return 3;
  else
    return 5;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f2d(%rip),%rax
movsbl (%rax),%eax
mov    0x2f2b(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    112c <f+0x2c>
movl   $0x3,-0x4(%rbp)
jmp    1133 <f+0x33>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@f.gender = internal global [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0)]
@.str = [5 x i8] c"male\00"
@.str.1 = [7 x i8] c"female\00"
@.str.2 = [2 x i8] c"?\00"
define i32 @f() {
%1 = alloca i32
%2 = load i8*, i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @f.gender, i64 0, i64 1)
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = load i8*, i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @f.gender, i64 0, i64 2)
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %4, %7
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 3, i32* %1
br label %11
10: ; preds = %0
store i32 5, i32* %1
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @f() {
ret i32 5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int /*<<< orphan*/);
void *xBuffer_alloc(int /*<<< orphan*/);
void *xBuffer_copy(uint32_t u32Size, void *pvInit, uint32_t u32InitSize) {
  void *pvAlloc = NULL;
  ;
  if ((pvAlloc = xBuffer_alloc(u32Size)) == NULL) {
    return NULL;
  }
  if (pvInit != NULL) {
    memcpy(pvAlloc, pvInit, u32InitSize);
  }
  return pvAlloc;
}


x86 assembly (clang, -O0):
<xBuffer_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <xBuffer_alloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    115d <xBuffer_copy+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1180 <xBuffer_copy+0x60>
cmpq   $0x0,-0x18(%rbp)
je     1178 <xBuffer_copy+0x58>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xBuffer_copy>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
call   1040 <xBuffer_alloc@plt>
mov    %rax,%rbp
test   %rbx,%rbx
je     114a <xBuffer_copy+0x2a>
test   %rbp,%rbp
je     114a <xBuffer_copy+0x2a>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <memcpy@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @xBuffer_copy(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @xBuffer_alloc(i32 %0)
%5 = icmp eq i8* %4, null
%6 = icmp eq i8* %1, null
%7 = or i1 %6, %5
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @memcpy(i8* %4, i8* %1, i32 %2)
br label %10
10: ; preds = %8, %3
ret i8* %4
}
int main(int argc, char **argv) {
  int fds[2];
  int ret;
  char c = 'x';
  int i = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x78,-0x1d(%rbp)
movl   $0x0,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 120, i8* %8
store i32 0, i32* %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void f11(short s, ...) {
  __builtin_va_list ap;
  __builtin_va_start(ap, s);
  __builtin_va_end(ap);
}


x86 assembly (clang, -O0):
<f11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
test   %al,%al
je     1136 <f11+0x36>
movaps %xmm0,-0xa0(%rbp)
movaps %xmm1,-0x90(%rbp)
movaps %xmm2,-0x80(%rbp)
movaps %xmm3,-0x70(%rbp)
movaps %xmm4,-0x60(%rbp)
movaps %xmm5,-0x50(%rbp)
movaps %xmm6,-0x40(%rbp)
movaps %xmm7,-0x30(%rbp)
mov    %r9,-0xa8(%rbp)
mov    %r8,-0xb0(%rbp)
mov    %rcx,-0xb8(%rbp)
mov    %rdx,-0xc0(%rbp)
mov    %rsi,-0xc8(%rbp)
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x30,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define void @f11(i16 signext %0, ...) {
%2 = alloca i16
%3 = alloca [1 x %struct.__va_list_tag]
store i16 %0, i16* %2
%4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%5 = bitcast %struct.__va_list_tag* %4 to i8*
%6 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%7 = bitcast %struct.__va_list_tag* %6 to i8*
ret void
}

LLVM IR (-O2):
define void @f11(i16 signext %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
void fail(const char *where) {
  fprintf(stderr, "load: ");
  perror(where);
  exit(1);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"load: \00"
define void @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @perror(i8* %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"load: \00"
define void @fail(i8* nocapture %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @perror(i8* %0)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct motor_speed {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ motor_speed_received(struct motor_speed *);
void notify_motor_speed_received(struct motor_speed *ms) {
  motor_speed_received(ms);
}


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

x86 assembly (clang, -O2):
<notify_motor_speed_received>:
jmp    1030 <motor_speed_received@plt>

LLVM IR (-O0):
%struct.motor_speed = type { i32 }
define void @notify_motor_speed_received(%struct.motor_speed* %0) {
%2 = alloca %struct.motor_speed*
store %struct.motor_speed* %0, %struct.motor_speed** %2
%3 = load %struct.motor_speed*, %struct.motor_speed** %2
%4 = call i32 @motor_speed_received(%struct.motor_speed* %3)
ret void
}

LLVM IR (-O2):
%struct.motor_speed = type { i32 }
define void @notify_motor_speed_received(%struct.motor_speed* %0) {
%2 = tail call i32 @motor_speed_received(%struct.motor_speed* %0)
ret void
}
void swap(int x, int y) {
  int temp = 0;
  temp = x;
  x = y;
  y = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @swap(i32 %0, i32 %1) {
ret void
}
test02(const char *s1) { return __builtin_strncmp(s1, "abcdefghi", 8); }


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

x86 assembly (clang, -O2):
<test02>:
lea    0xee9(%rip),%rsi
mov    $0x8,%edx
jmp    1030 <strncmp@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"abcdefghi\00"
define i32 @test02(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strncmp(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 8)
ret i32 %4
}

LLVM IR (-O2):
@.str = [10 x i8] c"abcdefghi\00"
define i32 @test02(i8* nocapture %0) {
%2 = tail call i32 @strncmp(i8* dereferenceable(1) %0, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 8)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
int parse_read_char(FILE *f, char x) {
  char c = 0;
  c = fgetc(f);
  if (c == x)
    return 0;
  ungetc(c, f);
  return 1;
}


x86 assembly (clang, -O0):
<parse_read_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    115e <parse_read_char+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1174 <parse_read_char+0x54>
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <ungetc@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_read_char>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <fgetc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %bpl,%cl
je     1146 <parse_read_char+0x26>
movsbl %cl,%edi
mov    %rbx,%rsi
call   1040 <ungetc@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_read_char(i32* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8
%6 = alloca i8
store i32* %0, i32** %4
store i8 %1, i8* %5
store i8 0, i8* %6
%7 = load i32*, i32** %4
%8 = call signext i8 @fgetc(i32* %7)
store i8 %8, i8* %6
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %10, %12
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %19
15: ; preds = %2
%16 = load i8, i8* %6
%17 = load i32*, i32** %4
%18 = call i32 @ungetc(i8 signext %16, i32* %17)
store i32 1, i32* %3
br label %19
19: ; preds = %15, %14
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @parse_read_char(i32* nocapture %0, i8 signext %1) {
%3 = tail call signext i8 @fgetc(i32* %0)
%4 = icmp eq i8 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @ungetc(i8 signext %3, i32* %0)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ usleep(int);
int main(void) {
  usleep(1000);
  foo();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e8,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @usleep(i32 1000)
%2 = tail call i32 (...) @foo()
ret i32 0
}
void smal_collect_before_mark() {}


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

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

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

LLVM IR (-O2):
define void @smal_collect_before_mark() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ createChildThreads();
int main(int argc, char *argv[]) {
  createChildThreads();
  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 <createChildThreads@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @createChildThreads()
ret i32 0
}
char digiCheck(char in) { return (char)(in >= '0' && in <= '9'); }


x86 assembly (clang, -O0):
<digiCheck>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <digiCheck+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digiCheck>:
add    $0xd0,%dil
cmp    $0xa,%dil
setb   %al
ret

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

LLVM IR (-O2):
define signext i8 @digiCheck(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i8
ret i8 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ vetor;

/* Variables and functions */
int positivo(int, int *);
int /*<<< orphan*/ printf(char *, int);
void main(void) {
  int vetor[] = {0, -1, -2, -3, 2, 1};
  int size = sizeof(vetor) / sizeof(int);
  printf("%d\n", positivo(size, vetor));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <positivo@plt>
mov    %eax,%esi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x6,%edi
call   1030 <positivo@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.vetor = [6 x i32] [i32 0, i32 -1, i32 -2, i32 -3, i32 2, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = bitcast [6 x i32]* %1 to i8*
store i32 6, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call i32 @positivo(i32 %4, i32* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@__const.main.vetor = [6 x i32] [i32 0, i32 -1, i32 -2, i32 -3, i32 2, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @positivo(i32 6, i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
void mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip) {}


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

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

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

LLVM IR (-O2):
%struct.mvebu_gpio_chip = type opaque
define void @mvebu_pwm_suspend(%struct.mvebu_gpio_chip* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void dev_close(int dev_fd) {
  if (dev_fd >= 0) {
    close(dev_fd);
  }
}


x86 assembly (clang, -O0):
<dev_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     112d <dev_close+0x1d>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_close>:
test   %edi,%edi
js     1119 <dev_close+0x9>
jmp    1030 <close@plt>
ret

LLVM IR (-O0):
define void @dev_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @close(i32 %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @dev_close(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
unsigned char SPI_MODE_2;
unsigned char spi_mode_2() { return SPI_MODE_2; }


x86 assembly (clang, -O0):
<spi_mode_2>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
movzbl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_mode_2>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%al
ret

LLVM IR (-O0):
@SPI_MODE_2 = global i8 0
define zeroext i8 @spi_mode_2() {
%1 = load i8, i8* @SPI_MODE_2
ret i8 %1
}

LLVM IR (-O2):
@SPI_MODE_2 = global i8 0
define zeroext i8 @spi_mode_2() {
%1 = load i8, i8* @SPI_MODE_2
ret i8 %1
}
int f6(int x, int y) {
  if (y < -1 || y > 24)
    __builtin_unreachable();
  return x % -y;
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jl     111e <f6+0x1e>
cmpl   $0x18,-0x8(%rbp)
jle    111e <f6+0x1e>
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6>:
mov    %edi,%eax
neg    %esi
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @f6(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 = icmp slt i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 24
br i1 %9, label %10, label %11
10: ; preds = %7, %2
unreachable
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = sub nsw i32 0, %13
%15 = srem i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @f6(i32 %0, i32 %1) {
%3 = add i32 %1, 1
%4 = icmp ult i32 %3, 26
tail call void @llvm.assume(i1 %4)
%5 = sub nsw i32 0, %1
%6 = srem i32 %0, %5
ret i32 %6
}
/* Variables and functions */
int rnd0(int);
int rnd1(int max) { return rnd0(max) + 1; }


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

x86 assembly (clang, -O2):
<rnd1>:
push   %rax
call   1030 <rnd0@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rnd1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @rnd0(i32 %3)
%5 = add nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @rnd1(i32 %0) {
%2 = tail call i32 @rnd0(i32 %0)
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Variables and functions */
scalar_t__ powf(int, int);
int decode_val(int val, int vlen) {
  int dval = 0;
  int bit = (val >> (vlen - 1)) & 1;
  if (bit == 0) {
    dval = -(~val & ((int)powf(2, vlen) - 1));
  } else {
    dval = val;
  }
  return dval;
}


x86 assembly (clang, -O0):
<decode_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    116a <decode_val+0x5a>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x2,%edi
call   1030 <powf@plt>
mov    -0x14(%rbp),%ecx
sub    $0x1,%eax
and    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <decode_val+0x60>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_val>:
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rsi),%eax
movzbl %al,%eax
bt     %eax,%edi
jb     1133 <decode_val+0x23>
not    %ebx
mov    $0x2,%edi
call   1030 <powf@plt>
add    $0xffffffff,%eax
and    %ebx,%eax
neg    %eax
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @decode_val(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = ashr i32 %7, %9
%11 = and i32 %10, 1
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %2
%15 = load i32, i32* %3
%16 = xor i32 %15, -1
%17 = load i32, i32* %4
%18 = call i64 @powf(i32 2, i32 %17)
%19 = trunc i64 %18 to i32
%20 = sub nsw i32 %19, 1
%21 = and i32 %16, %20
%22 = sub nsw i32 0, %21
store i32 %22, i32* %5
br label %25
23: ; preds = %2
%24 = load i32, i32* %3
store i32 %24, i32* %5
br label %25
25: ; preds = %23, %14
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @decode_val(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = shl nuw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = xor i32 %0, -1
%9 = tail call i64 @powf(i32 2, i32 %1)
%10 = trunc i64 %9 to i32
%11 = add nsw i32 %10, -1
%12 = and i32 %11, %8
%13 = sub nsw i32 0, %12
br label %14
14: ; preds = %2, %7
%15 = phi i32 [ %13, %7 ], [ %0, %2 ]
ret i32 %15
}
/* Variables and functions */
int any_decrqss(char const *, char *);
int rpt_DECSLPP(const char *the_title) { return any_decrqss(the_title, "t"); }


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

x86 assembly (clang, -O2):
<rpt_DECSLPP>:
lea    0xee9(%rip),%rsi
jmp    1030 <any_decrqss@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"t\00"
define i32 @rpt_DECSLPP(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @any_decrqss(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [2 x i8] c"t\00"
define i32 @rpt_DECSLPP(i8* %0) {
%2 = tail call i32 @any_decrqss(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
bool nrf52_errata_67(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_67() {
ret i32 0
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR5E_get(void) { return U_WMRCORENONE_get("U_WMRENDDOC"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"U_WMRENDDOC\00"
define i32 @U_WMR5E_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [12 x i8] c"U_WMRENDDOC\00"
define i32 @U_WMR5E_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}