xunge/DecIR huggingface dataset:
double f4(double x) { return (1.0 / (2.0 + x * x * x * x)); }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xedf(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xecb(%rip),%xmm0
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee8(%rip),%xmm1
movsd  0xee8(%rip),%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = load double, double* %2
%7 = fmul double %5, %6
%8 = load double, double* %2
%9 = call double @llvm.fmuladd.f64(double %7, double %8, double 2.000000e+00)
%10 = fdiv double 1.000000e+00, %9
ret double %10
}

LLVM IR (-O2):
define double @f4(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, %0
%4 = tail call double @llvm.fmuladd.f64(double %3, double %0, double 2.000000e+00)
%5 = fdiv double 1.000000e+00, %4
ret double %5
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
unsigned char Termios2TncomParity(struct termios *);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
unsigned char GetPortParity(int PortFd) {
  struct termios PortSettings;
  tcgetattr(PortFd, &PortSettings);
  return Termios2TncomParity(&PortSettings);
}


x86 assembly (clang, -O0):
<GetPortParity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1040 <tcgetattr@plt>
lea    -0x8(%rbp),%rdi
call   1030 <Termios2TncomParity@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetPortParity>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <tcgetattr@plt>
mov    %rbx,%rdi
call   1030 <Termios2TncomParity@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
define zeroext i8 @GetPortParity(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.termios
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @tcgetattr(i32 %4, %struct.termios* %3)
%6 = call zeroext i8 @Termios2TncomParity(%struct.termios* %3)
ret i8 %6
}

LLVM IR (-O2):
%struct.termios = type { i32 }
define zeroext i8 @GetPortParity(i32 %0) {
%2 = alloca %struct.termios
%3 = bitcast %struct.termios* %2 to i8*
%4 = call i32 @tcgetattr(i32 %0, %struct.termios* %2)
%5 = call zeroext i8 @Termios2TncomParity(%struct.termios* %2)
ret i8 %5
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t FRACMUL_SHL(int32_t x, int32_t y, int z) {
  return (int32_t)(((int64_t)x * y) >> (31 - z));
}


x86 assembly (clang, -O0):
<FRACMUL_SHL>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x1f,%ecx
sub    -0xc(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FRACMUL_SHL>:
mov    %edi,%eax
imul   %esi,%eax
mov    $0x1f,%cl
sub    %dl,%cl
sar    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @FRACMUL_SHL(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, %0
%5 = sub nsw i32 31, %2
%6 = ashr i32 %4, %5
ret i32 %6
}
/* Type definitions */
typedef unsigned int uint16_t;

/* Variables and functions */
__attribute__((pure, const)) uint16_t htooe16(uint16_t x) {
  return ((x >> 8U) & 0xffU) | ((x << 8U) & 0xff00U);
}


x86 assembly (clang, -O0):
<htooe16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<htooe16>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @htooe16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 8
%5 = and i32 %4, 255
%6 = load i32, i32* %2
%7 = shl i32 %6, 8
%8 = and i32 %7, 65280
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @htooe16(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int usage() {
  printf("Parameters:\n");
  printf("[ -f <filename> ]    file name to do the test on (default %s)\n",
         "essai_offset");
  printf("[ -sz <blockSize> ]  size of the block to start the loop from "
         "(default %d)\n",
         (9 * 512));
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xf0c(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
mov    $0x1200,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xf60(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0xef4(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x1200,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Parameters:\0A\00"
@.str.1 = [63 x i8] c"[ -f <filename> ] file name to do the test on (default %s)\0A\00"
@.str.2 = [13 x i8] c"essai_offset\00"
@.str.3 = [76 x i8] c"[ -sz <blockSize> ] size of the block to start the loop from (default %d)\0A\00"
define i32 @usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), i32 4608)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [63 x i8] c"[ -f <filename> ] file name to do the test on (default %s)\0A\00"
@.str.2 = [13 x i8] c"essai_offset\00"
@.str.3 = [76 x i8] c"[ -sz <blockSize> ] size of the block to start the loop from (default %d)\0A\00"
@str = [12 x i8] c"Parameters:\00"
define i32 @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), i32 4608)
%4 = tail call i32 @exit(i32 0)
unreachable
}
int foo(int j) {
  int i = 0;
  int temp_var;
  while (i < 100) {
    temp_var = i + j;
    i = temp_var + 2;
  }
  return i;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    112f <foo+0x2f>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <foo+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0xfffffffe,%eax
sub    %edi,%eax
add    $0x2,%edi
nopw   0x0(%rax,%rax,1)
add    %edi,%eax
cmp    $0x64,%eax
jl     1110 <foo+0x10>
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add i32 %0, 2
br label %3
3: ; preds = %3, %1
%4 = phi i32 [ 0, %1 ], [ %6, %3 ]
%5 = icmp slt i32 %4, 100
%6 = add i32 %2, %4
br i1 %5, label %3, label %7
7: ; preds = %3
ret i32 %4
}
int iscoperator(char c) { return '+' == c || '-' == c || '*' == c || '/' == c; }


x86 assembly (clang, -O0):
<iscoperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x2b,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115d <iscoperator+0x5d>
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x2d,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115d <iscoperator+0x5d>
movsbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x2a,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115d <iscoperator+0x5d>
movsbl -0x1(%rbp),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscoperator>:
cmp    $0x2d,%dil
ja     1120 <iscoperator+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x2c0000000000,%rdx
bt     %rcx,%rdx
jae    1120 <iscoperator+0x20>
ret
xor    %eax,%eax
cmp    $0x2f,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @iscoperator(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 43, %4
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 45, %8
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 42, %12
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 47, %16
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @iscoperator(i8 signext %0) {
switch i8 %0, label %2 [
i8 45, label %5
i8 43, label %5
i8 42, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 47
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void flushstdout() { fflush(stdout); }


x86 assembly (clang, -O0):
<flushstdout>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flushstdout>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @flushstdout() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @flushstdout() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
ret void
}
int test_imm_C1int8_reg(signed char val) {
  return ((val) & (-0xC1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C1int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff3f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C1int8_reg>:
test   $0xffffff3f,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C1int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -193
%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_C1int8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -193
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void fatalError(const char *errorStr) {
  fprintf(stderr, "%s\n", errorStr);
  exit(1);
}


x86 assembly (clang, -O0):
<fatalError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatalError>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @fatalError(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
int main(int argc, char **argv) {
  printf("Hellow world %d %s\n", argc, argv[argc - 1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movslq %edi,%rax
mov    -0x8(%rsi,%rax,8),%rdx
lea    0xee0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Hellow world %d %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = load i8**, i8*** %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8*, i8** %6, i64 %9
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Hellow world %d %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8*, i8** %1, i64 %4
%6 = load i8*, i8** %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %6)
ret i32 0
}
/* Type definitions */
struct _glist {
  int dummy;
};

/* Variables and functions */
void *canvas_undo_set_disconnect(struct _glist *, int, int, int, int);
void *canvas_undo_set_connect(struct _glist *x, int index1, int outno,
                              int index2, int inno) {
  return (canvas_undo_set_disconnect(x, index1, outno, index2, inno));
}


x86 assembly (clang, -O0):
<canvas_undo_set_connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <canvas_undo_set_disconnect@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canvas_undo_set_connect>:
jmp    1030 <canvas_undo_set_disconnect@plt>

LLVM IR (-O0):
%struct._glist = type { i32 }
define i8* @canvas_undo_set_connect(%struct._glist* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct._glist*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct._glist* %0, %struct._glist** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct._glist*, %struct._glist** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i8* @canvas_undo_set_disconnect(%struct._glist* %11, i32 %12, i32 %13, i32 %14, i32 %15)
ret i8* %16
}

LLVM IR (-O2):
%struct._glist = type { i32 }
define i8* @canvas_undo_set_connect(%struct._glist* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i8* @canvas_undo_set_disconnect(%struct._glist* %0, i32 %1, i32 %2, i32 %3, i32 %4)
ret i8* %6
}
void GPIOPinWrite(unsigned long ulPort, unsigned long ulPins,
                  unsigned char ucVal) {
  ;
  (*((volatile unsigned long *)(ulPort + 0x0000000C))) =
      ((ucVal & 1)
           ? ((*((volatile unsigned long *)(ulPort + 0x0000000C))) | ulPins)
           : ((*((volatile unsigned long *)(ulPort + 0x0000000C))) &
              ~(ulPins)));
}


x86 assembly (clang, -O0):
<GPIOPinWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1136 <GPIOPinWrite+0x36>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    114d <GPIOPinWrite+0x4d>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rax
mov    -0x10(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPinWrite>:
mov    0xc(%rdi),%rax
mov    %rsi,%rcx
not    %rcx
and    %rax,%rcx
or     %rsi,%rax
test   $0x1,%dl
cmove  %rcx,%rax
mov    %rax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @GPIOPinWrite(i64 %0, i64 %1, i8 zeroext %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %3
%12 = load i64, i64* %4
%13 = add i64 %12, 12
%14 = inttoptr i64 %13 to i64*
%15 = load volatile i64, i64* %14
%16 = load i64, i64* %5
%17 = or i64 %15, %16
br label %26
18: ; preds = %3
%19 = load i64, i64* %4
%20 = add i64 %19, 12
%21 = inttoptr i64 %20 to i64*
%22 = load volatile i64, i64* %21
%23 = load i64, i64* %5
%24 = xor i64 %23, -1
%25 = and i64 %22, %24
br label %26
26: ; preds = %18, %11
%27 = phi i64 [ %17, %11 ], [ %25, %18 ]
%28 = load i64, i64* %4
%29 = add i64 %28, 12
%30 = inttoptr i64 %29 to i64*
store volatile i64 %27, i64* %30
ret void
}

LLVM IR (-O2):
define void @GPIOPinWrite(i64 %0, i64 %1, i8 zeroext %2) {
%4 = and i8 %2, 1
%5 = icmp eq i8 %4, 0
%6 = add i64 %0, 12
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = xor i64 %1, -1
%10 = and i64 %8, %9
%11 = or i64 %8, %1
%12 = select i1 %5, i64 %10, i64 %11
store volatile i64 %12, i64* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *pn_realloc(void *p, size_t size) {
  void *ret = realloc(p, size);
  if (!ret) {
    do {
      fprintf(stderr, "Out of memory.\n");
      exit(1);
    } while (0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<pn_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <pn_realloc+0x50>
jmp    1161 <pn_realloc+0x31>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_realloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <pn_realloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define i8* @pn_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %17, label %11
11: ; preds = %2
br label %12
12: ; preds = %11
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; No predecessors!
br label %17
17: ; preds = %16, %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define noalias i8* @pn_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t size) {
  void *p = malloc(size);
  if (p == NULL) {
    fprintf(stderr, "allocation failed\n");
    abort();
  }
  return p;
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"allocation failed\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalnum(int);
void t_isalnum_0x5a() {
  Assert_real((isalnum(90)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              455, ("isalnum should be 1 for Z"));
}


x86 assembly (clang, -O0):
<t_isalnum_0x5a>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5a,%edi
call   1030 <isalnum@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1c7,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalnum_0x5a>:
push   %rax
mov    $0x5a,%edi
call   1030 <isalnum@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1c7,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 1 for Z\00"
define void @t_isalnum_0x5a() {
%1 = call i32 @isalnum(i32 90)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 455, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [26 x i8] c"isalnum should be 1 for Z\00"
define void @t_isalnum_0x5a() {
%1 = tail call i32 @isalnum(i32 90)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 455, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int BKDRHash(char *);
unsigned int hash(char *key, int segment_size) {
  return BKDRHash(key) % segment_size;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <BKDRHash@plt>
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %rbx
mov    %esi,%ebx
call   1030 <BKDRHash@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hash(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 = call i32 @BKDRHash(i8* %5)
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @hash(i8* %0, i32 %1) {
%3 = tail call i32 @BKDRHash(i8* %0)
%4 = srem i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ mhandle_hash_table_insert(void *, unsigned long, char *,
                                             int /*<<< orphan*/);
void __mhandle_register_ptr(void *ptr, unsigned long size, char *at) {
  mhandle_hash_table_insert(ptr, size, at, 0);
}


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

x86 assembly (clang, -O2):
<__mhandle_register_ptr>:
xor    %ecx,%ecx
jmp    1030 <mhandle_hash_table_insert@plt>

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

LLVM IR (-O2):
define void @__mhandle_register_ptr(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 @mhandle_hash_table_insert(i8* %0, i64 %1, i8* %2, i32 0)
ret void
}
/* Type definitions */
struct timeb {
  int time;
  scalar_t__ millitm;
};

/* Variables and functions */
int /*<<< orphan*/ ftime(struct timeb *);
size_t tpu_millitime() {
  struct timeb base;
  ftime(&base);
  size_t millis = 1000 * base.time;
  millis += base.millitm;
  return millis;
}


x86 assembly (clang, -O0):
<tpu_millitime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
call   1030 <ftime@plt>
imul   $0x3e8,-0x10(%rbp),%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tpu_millitime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1030 <ftime@plt>
movslq 0x8(%rsp),%rax
imul   $0x3e8,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeb = type { i32, i64 }
define i64 @tpu_millitime() {
%1 = alloca %struct.timeb
%2 = alloca i64
%3 = call i32 @ftime(%struct.timeb* %1)
%4 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 1000, %5
%7 = sext i32 %6 to i64
store i64 %7, i64* %2
%8 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i32 0, i32 1
%9 = load i64, i64* %8
%10 = load i64, i64* %2
%11 = add i64 %10, %9
store i64 %11, i64* %2
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
%struct.timeb = type { i32, i64 }
define i64 @tpu_millitime() {
%1 = alloca %struct.timeb
%2 = bitcast %struct.timeb* %1 to i8*
%3 = call i32 @ftime(%struct.timeb* %1)
%4 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %9, %7
ret i64 %10
}
int hisi_charger_type_notifier_unregister(struct notifier_block *nb) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.notifier_block = type opaque
define i32 @hisi_charger_type_notifier_unregister(%struct.notifier_block* nocapture readnone %0) {
ret i32 0
}
void fn0000000140001920() { return; }


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @fn0000000140001920() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) { printf("Recibida la señal %d\n", sig); }


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Recibida la se\C3\B1al %d\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Recibida la se\C3\B1al %d\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
size_t strcspn(char *, char *);
void choppy(char *s) { s[strcspn(s, "\n")] = '\0'; }


x86 assembly (clang, -O0):
<choppy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1030 <strcspn@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choppy>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcspn@plt>
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @choppy(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strcspn(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8, i8* %3, i64 %5
store i8 0, i8* %6
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @choppy(i8* nocapture %0) {
%2 = tail call i64 @strcspn(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds i8, i8* %0, i64 %2
store i8 0, i8* %3
ret void
}
/* Variables and functions */
int adc_read();
int read_bat(int n) {
  int i;
  int val;
  int sum;
  sum = 0;
  for (i = 0; i < n; i++) {
    val = (adc_read() * 1000) / 681;
    sum += val;
  }
  return sum / n;
}


x86 assembly (clang, -O0):
<read_bat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1164 <read_bat+0x54>
mov    $0x0,%al
call   1030 <adc_read@plt>
imul   $0x3e8,%eax,%eax
mov    $0x2a9,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <read_bat+0x19>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bat>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
test   %edi,%edi
jle    114c <read_bat+0x3c>
mov    %r14d,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <adc_read@plt>
imul   $0x3e8,%eax,%eax
cltq
imul   $0xc0784b3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
add    %eax,%ebp
add    $0xffffffff,%ebx
jne    1120 <read_bat+0x10>
jmp    114e <read_bat+0x3e>
xor    %ebp,%ebp
mov    %ebp,%eax
cltd
idiv   %r14d
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @read_bat(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %12
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %10, %3 ], [ 0, %1 ]
%6 = tail call i32 (...) @adc_read()
%7 = mul nsw i32 %6, 1000
%8 = sdiv i32 %7, 681
%9 = add nsw i32 %8, %4
%10 = add nuw nsw i32 %5, 1
%11 = icmp eq i32 %10, %0
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %9, %3 ]
%14 = sdiv i32 %13, %0
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ FormatOutput(char *, ...);
void Run_PrintVersion(void) {
  FormatOutput("\n");
  FormatOutput("semver increases version number in a file %s\n", "0.13.1");
  FormatOutput("\n");
}


x86 assembly (clang, -O0):
<Run_PrintVersion>:
push   %rbp
mov    %rsp,%rbp
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1030 <FormatOutput@plt>
lea    0xed7(%rip),%rdi
lea    0xefe(%rip),%rsi
mov    $0x0,%al
call   1030 <FormatOutput@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <FormatOutput@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Run_PrintVersion>:
push   %rbx
lea    0xf14(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <FormatOutput@plt>
lea    0xed7(%rip),%rdi
lea    0xefe(%rip),%rsi
xor    %eax,%eax
call   1030 <FormatOutput@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <FormatOutput@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [46 x i8] c"semver increases version number in a file %s\0A\00"
@.str.2 = [7 x i8] c"0.13.1\00"
define void @Run_PrintVersion() {
%1 = call i32 (i8*, ...) @FormatOutput(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @FormatOutput(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 (i8*, ...) @FormatOutput(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [46 x i8] c"semver increases version number in a file %s\0A\00"
@.str.2 = [7 x i8] c"0.13.1\00"
define void @Run_PrintVersion() {
%1 = tail call i32 (i8*, ...) @FormatOutput(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @FormatOutput(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @FormatOutput(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
int split_words(char *sentence) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @split_words(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("There were %d command lines arguments typed.\n", argc);
  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    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [46 x i8] c"There were %d command lines arguments typed.\0A\00"
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 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"There were %d command lines arguments typed.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct timeval timer_start() {
  struct timeval start_time;
  gettimeofday(&start_time, NULL);
  return start_time;
}


x86 assembly (clang, -O0):
<timer_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_start>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @timer_start() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @timer_start() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ calc(unsigned int, unsigned int);
int main(int argc, char **argv) {
  calc(14u, 3u);
  calc((15u + 5u), 9u);
  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    $0xe,%edi
mov    $0x3,%esi
call   1030 <calc@plt>
mov    $0x14,%edi
mov    $0x9,%esi
call   1030 <calc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xe,%edi
mov    $0x3,%esi
call   1030 <calc@plt>
mov    $0x14,%edi
mov    $0x9,%esi
call   1030 <calc@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 @calc(i32 14, i32 3)
%7 = call i32 @calc(i32 20, i32 9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @calc(i32 14, i32 3)
%4 = tail call i32 @calc(i32 20, i32 9)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __udivmoddi4(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/ *);
uint64_t __udivdi3(uint64_t n, uint64_t d) {
  return __udivmoddi4(n, d, (uint64_t *)0);
}


x86 assembly (clang, -O0):
<__udivdi3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <__udivmoddi4@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @__udivdi3(i32 %0, i32 %1) {
%3 = tail call i32 @__udivmoddi4(i32 %0, i32 %1, i32* null)
ret i32 %3
}
/* Type definitions */
struct Var {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pA(char *, char const *, char const *);
void __func_minus_double(struct Var *avar, const char *areg, const char *lreg,
                         const char *rreg) {
  pA("%s = -%s;", areg, lreg);
}


x86 assembly (clang, -O0):
<__func_minus_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec9(%rip),%rdi
call   1030 <pA@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Var = type { i32 }
@.str = [10 x i8] c"%s = -%s;\00"
define void @__func_minus_double(%struct.Var* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.Var*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.Var* %0, %struct.Var** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %7
%11 = call i32 @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.Var = type { i32 }
@.str = [10 x i8] c"%s = -%s;\00"
define void @__func_minus_double(%struct.Var* nocapture readnone %0, i8* %1, i8* %2, i8* nocapture readnone %3) {
%5 = tail call i32 @pA(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
int clause5(int script1, int script2) {
  if (script1 == 12448) {
    script1 = 12353;
  }
  if (script2 == 12448) {
    script2 = 12353;
  }
  return script1 == script2;
}


x86 assembly (clang, -O0):
<clause5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x30a0,-0x4(%rbp)
jne    111e <clause5+0x1e>
movl   $0x3041,-0x4(%rbp)
cmpl   $0x30a0,-0x8(%rbp)
jne    1132 <clause5+0x32>
movl   $0x3041,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clause5>:
cmp    $0x30a0,%edi
mov    $0x3041,%eax
cmove  %eax,%edi
cmp    $0x30a0,%esi
cmove  %eax,%esi
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @clause5(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 12448
%4 = select i1 %3, i32 12353, i32 %0
%5 = icmp eq i32 %1, 12448
%6 = select i1 %5, i32 12353, i32 %1
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void dm_ima_measure_on_device_rename(struct mapped_device *md) {}


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

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

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

LLVM IR (-O2):
%struct.mapped_device = type opaque
define void @dm_ima_measure_on_device_rename(%struct.mapped_device* nocapture %0) {
ret void
}
void XcmsCIELabWhiteShiftColors() {}


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

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

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

LLVM IR (-O2):
define void @XcmsCIELabWhiteShiftColors() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ b64decode(char *, int /*<<< orphan*/ *, int);
void base64decodeInplace(char *bufCoded) { b64decode(bufCoded, NULL, 1); }


x86 assembly (clang, -O0):
<base64decodeInplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%edx
call   1030 <b64decode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64decodeInplace>:
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <b64decode@plt>

LLVM IR (-O0):
define void @base64decodeInplace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @b64decode(i8* %3, i32* null, i32 1)
ret void
}

LLVM IR (-O2):
define void @base64decodeInplace(i8* %0) {
%2 = tail call i32 @b64decode(i8* %0, i32* null, i32 1)
ret void
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t i = 0;
  while (str[i++] != '\0')
    ;
  return i - 1;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1135 <strlen+0x35>
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %4, %2 ]
%4 = add i64 %3, 1
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
ret i64 %3
}