xunge/DecIR huggingface dataset:
int getrank(char c) {
  if (c >= '1' && c <= '8') {
    return c - '1';
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<getrank>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x31,%eax
jl     1133 <getrank+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x38,%eax
jg     1133 <getrank+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x31,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <getrank+0x3a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrank>:
lea    -0x31(%rdi),%eax
lea    -0x31(%rdi),%ecx
cmp    $0x8,%al
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @getrank(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 49
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 56
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 49
store i32 %14, i32* %2
br label %16
15: ; preds = %7, %1
store i32 -1, i32* %2
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @getrank(i8 signext %0) {
%2 = add i8 %0, -49
%3 = icmp ult i8 %2, 8
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -49
%6 = select i1 %3, i32 %5, i32 -1
ret i32 %6
}
/* Variables and functions */
char tolower(char);
char *lowstr(char *str) {
  register char *s = str;
  while ((*s = tolower(*s)))
    s++;
  return str;
}


x86 assembly (clang, -O0):
<lowstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    -0x10(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     114f <lowstr+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <lowstr+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowstr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <tolower@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %al,%al
jne    1120 <lowstr+0x10>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @lowstr(i8* returned %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call signext i8 @tolower(i8 signext %4)
store i8 %5, i8* %3
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %0
}
/* Type definitions */
typedef short int32_t;

/* Variables and functions */
__attribute__((always_)) int32_t __REVSH(int32_t value) {
  return (short)(((value & 0xFF00) >> 8) | ((value & 0x00FF) << 8));
}


x86 assembly (clang, -O0):
<__REVSH>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movswl -0x2(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<__REVSH>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define signext i16 @__REVSH(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 65280
%6 = ashr i32 %5, 8
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = and i32 %8, 255
%10 = shl i32 %9, 8
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @__REVSH(i16 signext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ ascii_dado();
void generate_answer(char *buf) {
  for (int i = 0; i < 4; i++)
    *buf++ = ascii_dado();
  *buf = '\0';
}


x86 assembly (clang, -O0):
<generate_answer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1155 <generate_answer+0x45>
mov    $0x0,%al
call   1030 <ascii_dado@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <generate_answer+0x13>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_answer>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <ascii_dado@plt>
mov    %al,(%rbx)
xor    %eax,%eax
call   1030 <ascii_dado@plt>
mov    %al,0x1(%rbx)
xor    %eax,%eax
call   1030 <ascii_dado@plt>
mov    %al,0x2(%rbx)
xor    %eax,%eax
call   1030 <ascii_dado@plt>
mov    %al,0x3(%rbx)
movb   $0x0,0x4(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @generate_answer(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = call i32 (...) @ascii_dado()
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
store i8 %9, i8* %10
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i8*, i8** %2
store i8 0, i8* %16
ret void
}

LLVM IR (-O2):
define void @generate_answer(i8* nocapture writeonly %0) {
%2 = tail call i32 (...) @ascii_dado()
%3 = trunc i32 %2 to i8
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %0
%5 = tail call i32 (...) @ascii_dado()
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %6, i8* %4
%8 = tail call i32 (...) @ascii_dado()
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %9, i8* %7
%11 = tail call i32 (...) @ascii_dado()
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %12, i8* %10
store i8 0, i8* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fabs(int);
float sqrt(int /*<<< orphan*/);
float findvffrom_a_vi_x(float a, float vi, float x) {
  return sqrt(fabs((2 * a * x) + (vi * vi)));
}


x86 assembly (clang, -O0):
<findvffrom_a_vi_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xec1(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findvffrom_a_vi_x>:
push   %rax
addss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define float @findvffrom_a_vi_x(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = fmul float 2.000000e+00, %7
%9 = load float, float* %6
%10 = load float, float* %5
%11 = load float, float* %5
%12 = fmul float %10, %11
%13 = call float @llvm.fmuladd.f32(float %8, float %9, float %12)
%14 = fptosi float %13 to i32
%15 = call i32 @fabs(i32 %14)
%16 = call float @sqrt(i32 %15)
ret float %16
}

LLVM IR (-O2):
define float @findvffrom_a_vi_x(float %0, float %1, float %2) {
%4 = fmul float %0, 2.000000e+00
%5 = fmul float %1, %1
%6 = tail call float @llvm.fmuladd.f32(float %4, float %2, float %5)
%7 = fptosi float %6 to i32
%8 = tail call i32 @fabs(i32 %7)
%9 = tail call float @sqrt(i32 %8)
ret float %9
}
/* Variables and functions */
int assert(int);
int foo() {
  int x;
  int y;
  x = 501;
  y = ~x;
  assert(x + y) == -1;
  assert(x & y) == 0;
  assert(x | y) == -1;
  assert(x ^ y) == -1;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1f5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    -0x8(%rbp),%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
and    -0x8(%rbp),%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
or     -0x8(%rbp),%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
xor    -0x8(%rbp),%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
store i32 501, i32* %1
%3 = load i32, i32* %1
%4 = xor i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = add nsw i32 %5, %6
%8 = call i32 @assert(i32 %7)
%9 = icmp eq i32 %8, -1
%10 = zext i1 %9 to i32
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = and i32 %11, %12
%14 = call i32 @assert(i32 %13)
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = or i32 %17, %18
%20 = call i32 @assert(i32 %19)
%21 = icmp eq i32 %20, -1
%22 = zext i1 %21 to i32
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = xor i32 %23, %24
%26 = call i32 @assert(i32 %25)
%27 = icmp eq i32 %26, -1
%28 = zext i1 %27 to i32
ret i32 0
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 @assert(i32 -1)
%2 = tail call i32 @assert(i32 0)
%3 = tail call i32 @assert(i32 -1)
%4 = tail call i32 @assert(i32 -1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FunctionWithArrayParam(int *);
int /*<<< orphan*/ FunctionWithMultiDimArray(int **);
void Array3() {
  int a[] = {1, 2, 3, 4};
  int b[2][2] = {{1, 2}, {3, 4}};
  FunctionWithArrayParam(a);
  FunctionWithMultiDimArray(b);
}


x86 assembly (clang, -O0):
<Array3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <FunctionWithArrayParam@plt>
lea    -0x20(%rbp),%rdi
call   1040 <FunctionWithMultiDimArray@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Array3>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rdi
call   1030 <FunctionWithArrayParam@plt>
mov    %rsp,%rdi
call   1040 <FunctionWithMultiDimArray@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.Array3.a = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@__const.Array3.b = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]]
define void @Array3() {
%1 = alloca [4 x i32]
%2 = alloca [2 x [2 x i32]]
%3 = bitcast [4 x i32]* %1 to i8*
%4 = bitcast [2 x [2 x i32]]* %2 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = call i32 @FunctionWithArrayParam(i32* %5)
%7 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0
%8 = bitcast [2 x i32]* %7 to i32**
%9 = call i32 @FunctionWithMultiDimArray(i32** %8)
ret void
}

LLVM IR (-O2):
@__const.Array3.a = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@__const.Array3.b = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]]
define void @Array3() {
%1 = alloca [4 x i32]
%2 = alloca [2 x [2 x i32]]
%3 = bitcast [4 x i32]* %1 to i8*
%4 = bitcast [2 x [2 x i32]]* %2 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = call i32 @FunctionWithArrayParam(i32* %5)
%7 = bitcast [2 x [2 x i32]]* %2 to i32**
%8 = call i32 @FunctionWithMultiDimArray(i32** %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
void pexit(const char *func) {
  perror(func);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<pexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<pexit>:
push   %rax
call   1030 <perror@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @pexit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @pexit(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *bb_basename(const char *name) {
  const char *cp = strrchr(name, '/');
  if (cp)
    return cp + 1;
  return name;
}


x86 assembly (clang, -O0):
<bb_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <bb_basename+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <bb_basename+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @bb_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ free(short *);
void freeShortVector(short int *vector) { free(vector); }


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

x86 assembly (clang, -O2):
<freeShortVector>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeShortVector(i16* nocapture %0) {
%2 = tail call i32 @free(i16* %0)
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
__attribute__((always_)) int detexPixel32GetSignedR8(uint32_t pixel) {
  return (int8_t)(pixel & 0xFF);
}


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

x86 assembly (clang, -O2):
<detexPixel32GetSignedR8>:
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @detexPixel32GetSignedR8(i32 %0) {
%2 = and i32 %0, 255
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ saluda();
int main() {
  saluda();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @saluda()
ret i32 0
}
/* Variables and functions */
void *sbrk(int);
int main(int argc, const char *argv[]) {
  void *sb, *sb1, *sb2, *sb3;
  sb = sbrk(sizeof(int));
  sb1 = sbrk(1024 * sizeof(int));
  sb2 = sbrk(2048 * sizeof(int));
  sb3 = sbrk(65536 * sizeof(int));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1000,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x20(%rbp)
mov    $0x2000,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x28(%rbp)
mov    $0x40000,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <sbrk@plt>
mov    $0x1000,%edi
call   1030 <sbrk@plt>
mov    $0x2000,%edi
call   1030 <sbrk@plt>
mov    $0x40000,%edi
call   1030 <sbrk@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**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i8* @sbrk(i32 4)
store i8* %10, i8** %6
%11 = call i8* @sbrk(i32 4096)
store i8* %11, i8** %7
%12 = call i8* @sbrk(i32 8192)
store i8* %12, i8** %8
%13 = call i8* @sbrk(i32 262144)
store i8* %13, i8** %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @sbrk(i32 4)
%4 = tail call i8* @sbrk(i32 4096)
%5 = tail call i8* @sbrk(i32 8192)
%6 = tail call i8* @sbrk(i32 262144)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ splitjoin_example(int, int);
void splitjoin_example_no_io() { splitjoin_example(5, 20); }


x86 assembly (clang, -O0):
<splitjoin_example_no_io>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
mov    $0x14,%esi
call   1030 <splitjoin_example@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitjoin_example_no_io>:
mov    $0x5,%edi
mov    $0x14,%esi
jmp    1030 <splitjoin_example@plt>

LLVM IR (-O0):
define void @splitjoin_example_no_io() {
%1 = call i32 @splitjoin_example(i32 5, i32 20)
ret void
}

LLVM IR (-O2):
define void @splitjoin_example_no_io() {
%1 = tail call i32 @splitjoin_example(i32 5, i32 20)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fscanf(int /*<<< orphan*/ *, char *, float *);
int zomp_readDouble(void *file, double *val) {
  float tmp = 0.0;
  int result = fscanf((FILE *)file, "%f", &tmp);
  *val = tmp;
  return result;
}


x86 assembly (clang, -O0):
<zomp_readDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <fscanf@plt>
mov    %eax,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zomp_readDouble>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movl   $0x0,0xc(%rsp)
lea    0xed9(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1030 <fscanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @zomp_readDouble(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
%5 = alloca float
%6 = alloca i32
store i8* %0, i8** %3
store double* %1, double** %4
store float 0.000000e+00, float* %5
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
%9 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %5)
store i32 %9, i32* %6
%10 = load float, float* %5
%11 = fpext float %10 to double
%12 = load double*, double** %4
store double %11, double* %12
%13 = load i32, i32* %6
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @zomp_readDouble(i8* nocapture %0, double* nocapture writeonly %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%5 = bitcast i8* %0 to i32*
%6 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%7 = load float, float* %3
%8 = fpext float %7 to double
store double %8, double* %1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((aligned(512))) hp1(void) { printf("hello, world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp1() align 512 {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int __do_fputs(char const *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int fputs(const char *str, FILE *fp) { return __do_fputs(str, fp, 0); }


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

x86 assembly (clang, -O2):
<fputs>:
xor    %edx,%edx
jmp    1030 <__do_fputs@plt>

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

LLVM IR (-O2):
define i32 @fputs(i8* %0, i32* %1) {
%3 = tail call i32 @__do_fputs(i8* %0, i32* %1, i32 0)
ret i32 %3
}
void default_mutex_unlock(volatile void *mutex) { (*(int *)mutex)--; }


x86 assembly (clang, -O0):
<default_mutex_unlock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_mutex_unlock>:
addl   $0xffffffff,(%rdi)
ret

LLVM IR (-O0):
define void @default_mutex_unlock(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = add nsw i32 %5, -1
store i32 %6, i32* %4
ret void
}

LLVM IR (-O2):
define void @default_mutex_unlock(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = add nsw i32 %3, -1
store i32 %4, i32* %2
ret void
}
/* Variables and functions */
long __ocml_round_f32(float);
long int lroundf(float x) { return __ocml_round_f32(x); }


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

x86 assembly (clang, -O2):
<lroundf>:
jmp    1030 <__ocml_round_f32@plt>

LLVM IR (-O0):
define i64 @lroundf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @__ocml_round_f32(float %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @lroundf(float %0) {
%2 = tail call i64 @__ocml_round_f32(float %0)
ret i64 %2
}
/* Type definitions */
typedef int u_int8_t;
typedef int u_int32_t;

/* Variables and functions */
int /*<<< orphan*/ read(int, int *, int);
u_int32_t be_read24(int fd) {
  u_int32_t word;
  u_int8_t buf[3];
  read(fd, buf, 3);
  word = (buf[0] << 16) | (buf[1] << 8) | buf[2];
  if (buf[0] > 0x7f)
    word |= (0xff << 24);
  return word;
}


x86 assembly (clang, -O0):
<be_read24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x3,%edx
call   1030 <read@plt>
mov    -0x14(%rbp),%eax
shl    $0x10,%eax
mov    -0x10(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7f,-0x14(%rbp)
jle    1155 <be_read24+0x45>
mov    -0x8(%rbp),%eax
or     $0xff000000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<be_read24>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rsi
mov    $0x3,%edx
call   1030 <read@plt>
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%edx
mov    %ecx,%eax
shl    $0x10,%eax
shl    $0x8,%edx
or     %eax,%edx
or     0x14(%rsp),%edx
mov    %edx,%eax
or     $0xff000000,%eax
cmp    $0x7f,%ecx
cmovle %edx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @be_read24(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i32]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%7 = call i32 @read(i32 %5, i32* %6, i32 3)
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%9 = load i32, i32* %8
%10 = shl i32 %9, 16
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
%12 = load i32, i32* %11
%13 = shl i32 %12, 8
%14 = or i32 %10, %13
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
%16 = load i32, i32* %15
%17 = or i32 %14, %16
store i32 %17, i32* %3
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 127
br i1 %20, label %21, label %24
21: ; preds = %1
%22 = load i32, i32* %3
%23 = or i32 %22, -16777216
store i32 %23, i32* %3
br label %24
24: ; preds = %21, %1
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @be_read24(i32 %0) {
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%5 = call i32 @read(i32 %0, i32* %4, i32 3)
%6 = load i32, i32* %4
%7 = shl i32 %6, 16
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %10, %7
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%13 = load i32, i32* %12
%14 = or i32 %11, %13
%15 = icmp sgt i32 %6, 127
%16 = or i32 %14, -16777216
%17 = select i1 %15, i32 %16, i32 %14
ret i32 %17
}
/* Variables and functions */
unsigned int f07(unsigned int);
unsigned int f08(unsigned int a) { return f07(f07(a)); }


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

x86 assembly (clang, -O2):
<f08>:
push   %rax
call   1030 <f07@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f07@plt>

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

LLVM IR (-O2):
define i32 @f08(i32 %0) {
%2 = tail call i32 @f07(i32 %0)
%3 = tail call i32 @f07(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ write(int, int *, int);
ssize_t i2c_write_addr_data16(int fd, uint8_t addr, uint16_t data) {
  uint8_t buffer[3];
  buffer[0] = addr;
  buffer[1] = data;
  buffer[2] = data >> 8;
  return write(fd, buffer, 3);
}


x86 assembly (clang, -O0):
<i2c_write_addr_data16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_write_addr_data16>:
sub    $0x18,%rsp
mov    %esi,0xc(%rsp)
mov    %edx,0x10(%rsp)
sar    $0x8,%edx
mov    %edx,0x14(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @i2c_write_addr_data16(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %6
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 %10, i32* %11
%12 = load i32, i32* %6
%13 = ashr i32 %12, 8
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 %13, i32* %14
%15 = load i32, i32* %4
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%17 = call i32 @write(i32 %15, i32* %16, i32 3)
ret i32 %17
}

LLVM IR (-O2):
define i32 @i2c_write_addr_data16(i32 %0, i32 %1, i32 %2) {
%4 = alloca [3 x i32]
%5 = bitcast [3 x i32]* %4 to i8*
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32 %1, i32* %6
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
store i32 %2, i32* %7
%8 = ashr i32 %2, 8
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
store i32 %8, i32* %9
%10 = call i32 @write(i32 %0, i32* %6, i32 3)
ret i32 %10
}
void initADC(void) {
  (*(volatile unsigned int *)(0x7E00B000)) |= (1 << 14);
  (*(volatile unsigned int *)(0x7E00B000)) =
      ((*(volatile unsigned int *)(0x7E00B000)) & 0xFFFFC03F) | (65 << 6);
  (*(volatile unsigned int *)(0x7E00B000)) &= 0xFFFFFFFB;
  (*(volatile unsigned int *)(0x7E00B000)) |= 1;
  while (1) {
    if (!((*(volatile unsigned int *)(0x7E00B000)) & 1))
      break;
  }
  return;
}


x86 assembly (clang, -O0):
<initADC>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7e00b000,%eax
mov    (%rax),%ecx
or     $0x4000,%ecx
mov    $0x7e00b000,%eax
mov    %ecx,(%rax)
mov    $0x7e00b000,%eax
mov    (%rax),%ecx
and    $0xffffc03f,%ecx
or     $0x1040,%ecx
mov    $0x7e00b000,%eax
mov    %ecx,(%rax)
mov    $0x7e00b000,%eax
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
mov    $0x7e00b000,%eax
mov    %ecx,(%rax)
mov    $0x7e00b000,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x7e00b000,%eax
mov    %ecx,(%rax)
mov    $0x7e00b000,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    116c <initADC+0x6c>
jmp    1171 <initADC+0x71>
jmp    1154 <initADC+0x54>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initADC>:
orl    $0x4000,0x7e00b000
mov    $0xffffc03f,%eax
and    0x7e00b000,%eax
or     $0x1040,%eax
mov    %eax,0x7e00b000
andl   $0xfffffffb,0x7e00b000
fb
orl    $0x1,0x7e00b000
01
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x7e00b000,%eax
test   $0x1,%al
jne    1140 <initADC+0x40>
ret

LLVM IR (-O0):
define void @initADC() {
%1 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%2 = or i32 %1, 16384
store volatile i32 %2, i32* inttoptr (i64 2113974272 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%4 = and i32 %3, -16321
%5 = or i32 %4, 4160
store volatile i32 %5, i32* inttoptr (i64 2113974272 to i32*)
%6 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%7 = and i32 %6, -5
store volatile i32 %7, i32* inttoptr (i64 2113974272 to i32*)
%8 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%9 = or i32 %8, 1
store volatile i32 %9, i32* inttoptr (i64 2113974272 to i32*)
br label %10
10: ; preds = %0, %15
%11 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10
br label %16
15: ; preds = %10
br label %10
16: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @initADC() {
%1 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%2 = or i32 %1, 16384
store volatile i32 %2, i32* inttoptr (i64 2113974272 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%4 = and i32 %3, -16321
%5 = or i32 %4, 4160
store volatile i32 %5, i32* inttoptr (i64 2113974272 to i32*)
%6 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%7 = and i32 %6, -5
store volatile i32 %7, i32* inttoptr (i64 2113974272 to i32*)
%8 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%9 = or i32 %8, 1
store volatile i32 %9, i32* inttoptr (i64 2113974272 to i32*)
br label %10
10: ; preds = %10, %0
%11 = load volatile i32, i32* inttoptr (i64 2113974272 to i32*)
%12 = and i32 %11, 1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %10
14: ; preds = %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bindshell();
int main(int argc, char **argv) {
  bindshell();
  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 <bindshell@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bindshell()
ret i32 0
}
int test_imm_FDuint32_mem(unsigned int *val) {
  return ((*val) & (0xFD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_FDuint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 253
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
void *_recv_msg(int, void *, int /*<<< orphan*/ *, int /*<<< orphan*/);
void *_recv_msg_nolength(int s, void *data) {
  int64_t length = 0;
  return (_recv_msg(s, data, &length, 0));
}


x86 assembly (clang, -O0):
<_recv_msg_nolength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <_recv_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_recv_msg_nolength>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
xor    %ecx,%ecx
call   1030 <_recv_msg@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @_recv_msg_nolength(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i8* @_recv_msg(i32 %0, i8* %1, i32* %3, i32 0)
ret i8* %5
}
/* Type definitions */
struct termios {
  int c_cflag;
};

/* Variables and functions */
int CSTOPB;
unsigned char Termios2TncomStopSize(struct termios *ti) {
  if ((ti->c_cflag & CSTOPB) == 0)
    return ((unsigned char)1);
  else
    return ((unsigned char)2);
}


x86 assembly (clang, -O0):
<Termios2TncomStopSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2ec3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1129 <Termios2TncomStopSize+0x29>
movb   $0x1,-0x1(%rbp)
jmp    112d <Termios2TncomStopSize+0x2d>
movb   $0x2,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Termios2TncomStopSize>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
and    (%rdi),%eax
cmp    $0x1,%eax
mov    $0x2,%al
sbb    $0x0,%al
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@CSTOPB = global i32 0
define zeroext i8 @Termios2TncomStopSize(%struct.termios* %0) {
%2 = alloca i8
%3 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %3
%4 = load %struct.termios*, %struct.termios** %3
%5 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = load i32, i32* @CSTOPB
%8 = and i32 %6, %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i8 1, i8* %2
br label %12
11: ; preds = %1
store i8 2, i8* %2
br label %12
12: ; preds = %11, %10
%13 = load i8, i8* %2
ret i8 %13
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@CSTOPB = global i32 0
define zeroext i8 @Termios2TncomStopSize(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @CSTOPB
%5 = and i32 %4, %3
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8 1, i8 2
ret i8 %7
}
/* Type definitions */
typedef int ptrdiff_t;

/* Variables and functions */
ptrdiff_t wstr_posrelat(ptrdiff_t pos, size_t len) {
  return (pos >= 0) ? pos : (ptrdiff_t)len + pos + 1;
}


x86 assembly (clang, -O0):
<wstr_posrelat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1120 <wstr_posrelat+0x20>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    112d <wstr_posrelat+0x2d>
mov    -0x10(%rbp),%rax
add    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wstr_posrelat>:
test   %edi,%edi
lea    0x1(%rdi,%rsi,1),%eax
cmovns %edi,%eax
ret

LLVM IR (-O0):
define i32 @wstr_posrelat(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
br label %15
9: ; preds = %2
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = add nsw i32 %13, 1
br label %15
15: ; preds = %9, %7
%16 = phi i32 [ %8, %7 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @wstr_posrelat(i32 %0, i64 %1) {
%3 = icmp sgt i32 %0, -1
%4 = trunc i64 %1 to i32
%5 = add i32 %0, 1
%6 = add i32 %5, %4
%7 = select i1 %3, i32 %0, i32 %6
ret i32 %7
}
int I_HaveSoftwareKeyboard(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @I_HaveSoftwareKeyboard() {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) int is_halfword_multi(uint32_t op) {
  return !((op & 0x0F900090) ^ 0x01000080);
}


x86 assembly (clang, -O0):
<is_halfword_multi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf900090,%eax
xor    $0x1000080,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_halfword_multi>:
and    $0xf900090,%edi
xor    %eax,%eax
cmp    $0x1000080,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_halfword_multi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 261095568
%5 = xor i32 %4, 16777344
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_halfword_multi(i32 %0) {
%2 = and i32 %0, 261095568
%3 = icmp eq i32 %2, 16777344
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void if_lt(void) { printf("less than\n"); }


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"less than\00"
define void @if_lt() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
void frac_debug() {}


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

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

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

LLVM IR (-O2):
define void @frac_debug() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _assert(int, char *, int, char *);
int intr_cur();
int evt_cur(void) {
  int irq;
  irq = intr_cur();
  _assert(
      (irq >= 0),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/mthiffau/HeatheRTOS/refs/heads/master/event.c",
      97, "irq >= 0");
  return irq;
}


x86 assembly (clang, -O0):
<evt_cur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <intr_cur@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebb(%rip),%rsi
mov    $0x61,%edx
lea    0xf37(%rip),%rcx
call   1040 <_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evt_cur>:
push   %rbx
xor    %eax,%eax
call   1030 <intr_cur@plt>
mov    %eax,%ebx
mov    %eax,%edi
not    %edi
shr    $0x1f,%edi
lea    0xec8(%rip),%rsi
lea    0xf49(%rip),%rcx
mov    $0x61,%edx
call   1040 <_assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mthiffau/HeatheRTOS/refs/heads/master/event.c\00"
@.str.1 = [9 x i8] c"irq >= 0\00"
define i32 @evt_cur() {
%1 = alloca i32
%2 = call i32 (...) @intr_cur()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp sge i32 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @_assert(i32 %5, i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 97, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mthiffau/HeatheRTOS/refs/heads/master/event.c\00"
@.str.1 = [9 x i8] c"irq >= 0\00"
define i32 @evt_cur() {
%1 = tail call i32 (...) @intr_cur()
%2 = xor i32 %1, -1
%3 = lshr i32 %2, 31
%4 = tail call i32 @_assert(i32 %3, i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 97, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ __SYSCALL_LL_O(unsigned long long);
int syscall(int, unsigned int, int /*<<< orphan*/, int, char const *);
int fanotify_mark(int fanotify_fd, unsigned flags, unsigned long long mask,
                  int dfd, const char *pathname) {
  return syscall(368, flags, __SYSCALL_LL_O(mask), dfd, pathname);
}


x86 assembly (clang, -O0):
<fanotify_mark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <__SYSCALL_LL_O@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    $0x170,%edi
call   1030 <syscall@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fanotify_mark>:
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %ecx,%ebp
mov    %rdx,%rdi
mov    %esi,%ebx
call   1040 <__SYSCALL_LL_O@plt>
mov    $0x170,%edi
mov    %ebx,%esi
mov    %eax,%edx
mov    %ebp,%ecx
mov    %r14,%r8
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @fanotify_mark(i32 %0, i32 %1, i64 %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i32, i32* %7
%12 = load i64, i64* %8
%13 = call i32 @__SYSCALL_LL_O(i64 %12)
%14 = load i32, i32* %9
%15 = load i8*, i8** %10
%16 = call i32 @syscall(i32 368, i32 %11, i32 %13, i32 %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @fanotify_mark(i32 %0, i32 %1, i64 %2, i32 %3, i8* %4) {
%6 = tail call i32 @__SYSCALL_LL_O(i64 %2)
%7 = tail call i32 @syscall(i32 368, i32 %1, i32 %6, i32 %3, i8* %4)
ret i32 %7
}
void lcdExecuteFunction(int num) {
  switch (num) {
  case 1:
    break;
  }
}


x86 assembly (clang, -O0):
<lcdExecuteFunction>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
jne    111d <lcdExecuteFunction+0x1d>
jmp    1118 <lcdExecuteFunction+0x18>
jmp    111d <lcdExecuteFunction+0x1d>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @lcdExecuteFunction(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %5 [
i32 1, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
ret void
}

LLVM IR (-O2):
define void @lcdExecuteFunction(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(int, int, int, unsigned long long);
int main() {
  f(1, 2, 3, 04000000000005ULL);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
movabs $0x4000000005,%rcx
call   1030 <f@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x4000000005,%rcx
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <f@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 1, i32 2, i32 3, i64 274877906949)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1, i32 2, i32 3, i64 274877906949)
%2 = tail call i32 @exit(i32 0)
unreachable
}