xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_202() {
  Assert_real((isqrt(202) == 14),
              "/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/stdlib/isqrt.c",
              1015, ("Integer square root of 202 should be 14"));
}


x86 assembly (clang, -O0):
<t_sqrt_202>:
push   %rbp
mov    %rsp,%rbp
mov    $0xca,%edi
call   1030 <isqrt@plt>
cmp    $0xe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x3f7,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_202>:
push   %rax
mov    $0xca,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xe,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x3f7,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 202 should be 14\00"
define void @t_sqrt_202() {
%1 = call i32 @isqrt(i32 202)
%2 = icmp eq i32 %1, 14
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1015, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 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/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 202 should be 14\00"
define void @t_sqrt_202() {
%1 = tail call i32 @isqrt(i32 202)
%2 = icmp eq i32 %1, 14
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1015, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int volatile);
int main() {
  volatile uint64_t a = 0xffffffffffffffff, b = 0;
  b = a ^ 0xffffffffffffffff;
  printf("%ld\n", b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xffffffff,0x4(%rsp)
ff
movl   $0x0,(%rsp)
mov    0x4(%rsp),%eax
not    %eax
mov    %eax,(%rsp)
mov    (%rsp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store volatile i32 -1, i32* %2
store volatile i32 0, i32* %3
%4 = load volatile i32, i32* %2
%5 = sext i32 %4 to i64
%6 = xor i64 %5, -1
%7 = trunc i64 %6 to i32
store volatile i32 %7, i32* %3
%8 = load volatile i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store volatile i32 -1, i32* %1
%4 = bitcast i32* %2 to i8*
store volatile i32 0, i32* %2
%5 = load volatile i32, i32* %1
%6 = xor i32 %5, -1
store volatile i32 %6, i32* %2
%7 = load volatile i32, i32* %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Type definitions */
struct v4l2_format {
  unsigned int type;
};

/* Variables and functions */
int /*<<< orphan*/ memset(struct v4l2_format *, int /*<<< orphan*/, int);
void v4l_format_init(struct v4l2_format *fmt, unsigned type) {
  memset(fmt, 0, sizeof(*fmt));
  fmt->type = type;
}


x86 assembly (clang, -O0):
<v4l_format_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_format_init>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.v4l2_format = type { i32 }
define void @v4l_format_init(%struct.v4l2_format* %0, i32 %1) {
%3 = alloca %struct.v4l2_format*
%4 = alloca i32
store %struct.v4l2_format* %0, %struct.v4l2_format** %3
store i32 %1, i32* %4
%5 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%6 = call i32 @memset(%struct.v4l2_format* %5, i32 0, i32 4)
%7 = load i32, i32* %4
%8 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%9 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %8, i32 0, i32 0
store i32 %7, i32* %9
ret void
}

LLVM IR (-O2):
%struct.v4l2_format = type { i32 }
define void @v4l_format_init(%struct.v4l2_format* %0, i32 %1) {
%3 = tail call i32 @memset(%struct.v4l2_format* %0, i32 0, i32 4)
%4 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 0
store i32 %1, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_black(unsigned char *, int);
int /*<<< orphan*/ set_white(unsigned char *, int);
void set_bw(unsigned char *bw, int i, unsigned char val) {
  if (val > 127) {
    set_black(bw, i);
  } else {
    set_white(bw, i);
  }
}


x86 assembly (clang, -O0):
<set_bw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x7f,%eax
jle    1152 <set_bw+0x32>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <set_black@plt>
jmp    115e <set_bw+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <set_white@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bw>:
test   %dl,%dl
js     1129 <set_bw+0x9>
jmp    1040 <set_white@plt>
jmp    1030 <set_black@plt>

LLVM IR (-O0):
define void @set_bw(i8* %0, i32 %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = icmp sgt i32 %8, 127
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i32 @set_black(i8* %11, i32 %12)
br label %18
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = call i32 @set_white(i8* %15, i32 %16)
br label %18
18: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
define void @set_bw(i8* %0, i32 %1, i8 zeroext %2) {
%4 = icmp slt i8 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @set_black(i8* %0, i32 %1)
br label %9
7: ; preds = %3
%8 = tail call i32 @set_white(i8* %0, i32 %1)
br label %9
9: ; preds = %7, %5
ret void
}
int test_imm_89uint8_reg(unsigned char val) {
  return ((val) & (-0x89 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_89uint8_reg>:
test   $0x77,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_89uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -137
%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_89uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 119
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int atoi(char *);
int strToInt(char *str) { return atoi(str); }


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

x86 assembly (clang, -O2):
<strToInt>:
jmp    1030 <atoi@plt>

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

LLVM IR (-O2):
define i32 @strToInt(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
ret i32 %2
}
int test_imm_2Fuint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x2F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Fuint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 47
%6 = icmp ne i64 %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_2Fuint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 47
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
bool AONBatMonNewBatteryMeasureReady(void) {
  bool bStatus;
  bStatus =
      (*((volatile unsigned long *)(0x40095000 + 0x0000002C))) & 0x00000001
          ? true
          : false;
  if (bStatus) {
    (*((volatile unsigned long *)(0x40095000 + 0x0000002C))) = 1;
  }
  return (bStatus);
}


x86 assembly (clang, -O0):
<AONBatMonNewBatteryMeasureReady>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4009502c,%eax
mov    (%rax),%rdx
and    $0x1,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1137 <AONBatMonNewBatteryMeasureReady+0x37>
mov    $0x4009502c,%eax
movq   $0x1,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AONBatMonNewBatteryMeasureReady>:
mov    0x4009502c,%rax
40
test   $0x1,%al
je     1118 <AONBatMonNewBatteryMeasureReady+0x18>
movq   $0x1,0x4009502c
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @AONBatMonNewBatteryMeasureReady() {
%1 = alloca i32
%2 = load volatile i64, i64* inttoptr (i64 1074352172 to i64*)
%3 = and i64 %2, 1
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %0
store volatile i64 1, i64* inttoptr (i64 1074352172 to i64*)
br label %10
10: ; preds = %9, %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @AONBatMonNewBatteryMeasureReady() {
%1 = load volatile i64, i64* inttoptr (i64 1074352172 to i64*)
%2 = and i64 %1, 1
%3 = icmp eq i64 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %0
store volatile i64 1, i64* inttoptr (i64 1074352172 to i64*)
br label %5
5: ; preds = %4, %0
%6 = xor i1 %3, true
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int M_PI;
int angle_slice(double alpha, double sec_count) {
  return (alpha / ((M_PI * 2) / sec_count));
}


x86 assembly (clang, -O0):
<angle_slice>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ece(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<angle_slice>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
@M_PI = global i32 0
define i32 @angle_slice(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load i32, i32* @M_PI
%7 = mul nsw i32 %6, 2
%8 = sitofp i32 %7 to double
%9 = load double, double* %4
%10 = fdiv double %8, %9
%11 = fdiv double %5, %10
%12 = fptosi double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@M_PI = global i32 0
define i32 @angle_slice(double %0, double %1) {
%3 = load i32, i32* @M_PI
%4 = shl nsw i32 %3, 1
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, %1
%7 = fdiv double %0, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
void CNFGLoadExtensionsInternal() {}


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

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

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

LLVM IR (-O2):
define void @CNFGLoadExtensionsInternal() {
ret void
}
int ld_ge_mm1(long double *a1, long double *a2) { return (((*a1) >= (*a2))); }


x86 assembly (clang, -O0):
<ld_ge_mm1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    -0x10(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_ge_mm1>:
fldt   (%rdi)
fldt   (%rsi)
xor    %eax,%eax
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
ret

LLVM IR (-O0):
define i32 @ld_ge_mm1(x86_fp80* %0, x86_fp80* %1) {
%3 = alloca x86_fp80*
%4 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %3
store x86_fp80* %1, x86_fp80** %4
%5 = load x86_fp80*, x86_fp80** %3
%6 = load x86_fp80, x86_fp80* %5
%7 = load x86_fp80*, x86_fp80** %4
%8 = load x86_fp80, x86_fp80* %7
%9 = fcmp oge x86_fp80 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ld_ge_mm1(x86_fp80* nocapture %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = load x86_fp80, x86_fp80* %1
%5 = fcmp oge x86_fp80 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
int fun326() { return 326; }


x86 assembly (clang, -O0):
<fun326>:
push   %rbp
mov    %rsp,%rbp
mov    $0x146,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun326() {
ret i32 326
}

LLVM IR (-O2):
define i32 @fun326() {
ret i32 326
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int);
int /*<<< orphan*/ stderr;
void perror(const char *s) { fprintf(stderr, "%s: error %d\n", s, errno); }


x86 assembly (clang, -O0):
<perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ecx
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perror>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
lea    0xed4(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"%s: error %d\0A\00"
@errno = global i32 0
define void @perror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0xc4() {
  Assert_real((ispunct(196) == 0),
              "/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_ispunct.c",
              985, ("ispunct should be 0 for 0xc4"));
}


x86 assembly (clang, -O0):
<t_ispunct_0xc4>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc4,%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x3d9,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0xc4>:
push   %rax
mov    $0xc4,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3d9,%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_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xc4\00"
define void @t_ispunct_0xc4() {
%1 = call i64 @ispunct(i32 196)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 985, i8* getelementptr inbounds ([29 x i8], [29 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_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xc4\00"
define void @t_ispunct_0xc4() {
%1 = tail call i64 @ispunct(i32 196)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 985, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ crypto_put_default_null_skcipher();
void crypto_put_default_null_skcipher2(void) {
  crypto_put_default_null_skcipher();
}


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

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

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

LLVM IR (-O2):
define void @crypto_put_default_null_skcipher2() {
%1 = tail call i32 (...) @crypto_put_default_null_skcipher()
ret void
}
int do_654() { return 654; }


x86 assembly (clang, -O0):
<do_654>:
push   %rbp
mov    %rsp,%rbp
mov    $0x28e,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_654() {
ret i32 654
}

LLVM IR (-O2):
define i32 @do_654() {
ret i32 654
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sprintDisassembleInst(int, char *, int);
int /*<<< orphan*/ stderr;
void unimplemented(int pc) {
  char buf[80];
  sprintDisassembleInst(pc, buf, sizeof(buf));
  fprintf(stderr, "Unimplmented instruction: %s\n", buf);
  exit(1);
}


x86 assembly (clang, -O0):
<unimplemented>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x50,%edx
call   1050 <sprintDisassembleInst@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rdx
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<unimplemented>:
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x50,%edx
call   1050 <sprintDisassembleInst@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Unimplmented instruction: %s\0A\00"
define void @unimplemented(i32 %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintDisassembleInst(i32 %0, i8* %3, i32 80)
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ interrupt(int, int, char *, char *, int /*<<< orphan*/);
void typeCommand(char *args[]) {
  char buffer[(32 - 6) * 512];
  interrupt(0x21, 0x3, args[1], buffer, 0);
  interrupt(0x21, 0x0, buffer, 0, 0);
  return;
}


x86 assembly (clang, -O0):
<typeCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3410,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x3410(%rbp),%rcx
mov    $0x21,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    -0x3410(%rbp),%rdx
mov    $0x21,%edi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%esi
call   1030 <interrupt@plt>
add    $0x3410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typeCommand>:
push   %rbx
sub    $0x3400,%rsp
mov    0x8(%rdi),%rdx
mov    %rsp,%rbx
mov    $0x21,%edi
mov    $0x3,%esi
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
mov    $0x21,%edi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
add    $0x3400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @typeCommand(i8** %0) {
%2 = alloca i8**
%3 = alloca [13312 x i8]
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds [13312 x i8], [13312 x i8]* %3, i64 0, i64 0
%8 = call i32 @interrupt(i32 33, i32 3, i8* %6, i8* %7, i32 0)
%9 = getelementptr inbounds [13312 x i8], [13312 x i8]* %3, i64 0, i64 0
%10 = call i32 @interrupt(i32 33, i32 0, i8* %9, i8* null, i32 0)
ret void
}

LLVM IR (-O2):
define void @typeCommand(i8** nocapture %0) {
%2 = alloca [13312 x i8]
%3 = getelementptr inbounds [13312 x i8], [13312 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = call i32 @interrupt(i32 33, i32 3, i8* %5, i8* %3, i32 0)
%7 = call i32 @interrupt(i32 33, i32 0, i8* %3, i8* null, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ max(int, int);
int min(int /*<<< orphan*/, int);
int clamp(int v, int low, int high) { return min(max(v, low), high); }


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

x86 assembly (clang, -O2):
<clamp>:
push   %rbx
mov    %edx,%ebx
call   1040 <max@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <min@plt>

LLVM IR (-O0):
define i32 @clamp(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 = call i32 @max(i32 %7, i32 %8)
%10 = load i32, i32* %6
%11 = call i32 @min(i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @clamp(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @max(i32 %0, i32 %1)
%5 = tail call i32 @min(i32 %4, i32 %2)
ret i32 %5
}
double area(double side1, double side2) { return side1 * side2; }


x86 assembly (clang, -O0):
<area>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<area>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @area(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @area(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
main() {
  assert('\xa' == 10);
  assert('\11' == 9);
  assert('\111' == 73);
  assert("\xb"[0] == 11);
  assert(255 == 0xff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
movsbl 0xebc(%rip),%eax
cmp    $0xb,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [2 x i8] c"\0B\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @assert(i32 1)
%3 = call i32 @assert(i32 1)
%4 = call i32 @assert(i32 1)
%5 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 11
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @assert(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
ret i32 0
}
void UI_ctrl(void) {}


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

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

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

LLVM IR (-O2):
define void @UI_ctrl() {
ret void
}
void genceil_w_s() {}


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

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

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

LLVM IR (-O2):
define void @genceil_w_s() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int methodA(int a, int b) {
  printf("FileLocalA used by F\n");
  return a - b;
}


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

x86 assembly (clang, -O2):
<methodA>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
sub    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"FileLocalA used by F\0A\00"
define i32 @methodA(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = sub nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
@str = [21 x i8] c"FileLocalA used by F\00"
define i32 @methodA(i32 %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = sub nsw i32 %0, %1
ret i32 %4
}
void f(int v) {
  switch (v) {
  case 1:
    break;
    break;
  }
}


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

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

LLVM IR (-O0):
define void @f(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 @f(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void doBeep(void) { write(1, "\7", 1); }


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

x86 assembly (clang, -O2):
<doBeep>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\07\00"
define void @doBeep() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\07\00"
define void @doBeep() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, char *, int *);
int read_int_from_config_line(char *config_line) {
  char prm_name[20];
  int val;
  sscanf(config_line, "%s %d\n", prm_name, &val);
  return val;
}


x86 assembly (clang, -O0):
<read_int_from_config_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xed5(%rip),%rsi
lea    -0x24(%rbp),%rcx
call   1030 <sscanf@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int_from_config_line>:
sub    $0x28,%rsp
lea    0xee5(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <sscanf@plt>
mov    0xc(%rsp),%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s %d\0A\00"
define i32 @read_int_from_config_line(i8* %0) {
%2 = alloca i8*
%3 = alloca [20 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i32* %4)
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s %d\0A\00"
define i32 @read_int_from_config_line(i8* nocapture %0) {
%2 = alloca [20 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i32* %3)
%7 = load i32, i32* %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ str_max_n_cat(char *, char const *, int);
int /*<<< orphan*/ str_nz_cpy(char *, char const *, int);
char *cat_path(const char *path, const char *file) {
  static char dst[127 + 1];
  str_nz_cpy(dst, path, 127);
  str_max_n_cat(dst, "/", 127);
  str_max_n_cat(dst, file, 127);
  return dst;
}


x86 assembly (clang, -O0):
<cat_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f05(%rip),%rdi
mov    $0x7f,%edx
call   1030 <str_nz_cpy@plt>
lea    0x2ef4(%rip),%rdi
lea    0xead(%rip),%rsi
mov    $0x7f,%edx
call   1040 <str_max_n_cat@plt>
mov    -0x10(%rbp),%rsi
lea    0x2ed8(%rip),%rdi
mov    $0x7f,%edx
call   1040 <str_max_n_cat@plt>
lea    0x2ec7(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat_path>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0x2f0f(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7f,%edx
call   1030 <str_nz_cpy@plt>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7f,%edx
call   1040 <str_max_n_cat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7f,%edx
call   1040 <str_max_n_cat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@cat_path.dst = internal global [128 x i8] zeroinitializer
@.str = [2 x i8] c"/\00"
define i8* @cat_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @str_nz_cpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0), i8* %5, i32 127)
%7 = call i32 @str_max_n_cat(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 127)
%8 = load i8*, i8** %4
%9 = call i32 @str_max_n_cat(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0), i8* %8, i32 127)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0)
}

LLVM IR (-O2):
@cat_path.dst = internal global [128 x i8] zeroinitializer
@.str = [2 x i8] c"/\00"
define i8* @cat_path(i8* %0, i8* %1) {
%3 = tail call i32 @str_nz_cpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0), i8* %0, i32 127)
%4 = tail call i32 @str_max_n_cat(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 127)
%5 = tail call i32 @str_max_n_cat(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0), i8* %1, i32 127)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @cat_path.dst, i64 0, i64 0)
}
int read() {}


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

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

LLVM IR (-O0):
define i32 @read() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @read() {
ret i32 undef
}
digit(x) { return (x >= '0' && x <= '9'); }


x86 assembly (clang, -O0):
<digit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <digit+0x20>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @digit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void lfb_exit_error(char *str) {
  write(1, str, strlen(str));
  exit(1);
}


x86 assembly (clang, -O0):
<lfb_exit_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<lfb_exit_error>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @lfb_exit_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 1, i8* %3, i32 %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @lfb_exit_error(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int lucas(int n) {
  if (n == 0) {
    return 2;
  }
  if (n == 1) {
    return 1;
  }
  return lucas(n - 1) + lucas(n - 2);
}


x86 assembly (clang, -O0):
<lucas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <lucas+0x21>
movl   $0x2,-0x4(%rbp)
jmp    116a <lucas+0x5a>
cmpl   $0x1,-0x8(%rbp)
jne    1147 <lucas+0x37>
movl   $0x1,-0x4(%rbp)
jmp    116a <lucas+0x5a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <lucas@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <lucas@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lucas>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
test   %ebx,%ebx
je     1136 <lucas+0x26>
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%ebx
je     113d <lucas+0x2d>
lea    -0x1(%rbx),%edi
call   1030 <lucas@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
test   %ebx,%ebx
jne    1120 <lucas+0x10>
mov    $0x2,%eax
jmp    1142 <lucas+0x32>
mov    $0x1,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @lucas(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i32 [ 0, %1 ], [ %9, %5 ]
%4 = phi i32 [ %0, %1 ], [ %8, %5 ]
switch i32 %4, label %5 [
i32 0, label %10
i32 1, label %11
]
5: ; preds = %2
%6 = add nsw i32 %4, -1
%7 = tail call i32 @lucas(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %3
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i32 [ 2, %10 ], [ 1, %2 ]
%13 = add nsw i32 %12, %3
ret i32 %13
}
int main(int argc, const char *argv[]) {
  struct my_struct {
    int a;
    double b;
  };
  struct my_struct array[2];
  int x = array[0].a + array[1].a;
  double y = array[0].b + array[1].b;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x30(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.my_struct = type { i32, double }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x %struct.my_struct]
%7 = alloca i32
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = getelementptr inbounds [2 x %struct.my_struct], [2 x %struct.my_struct]* %6, i64 0, i64 0
%10 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds [2 x %struct.my_struct], [2 x %struct.my_struct]* %6, i64 0, i64 1
%13 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = add nsw i32 %11, %14
store i32 %15, i32* %7
%16 = getelementptr inbounds [2 x %struct.my_struct], [2 x %struct.my_struct]* %6, i64 0, i64 0
%17 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %16, i32 0, i32 1
%18 = load double, double* %17
%19 = getelementptr inbounds [2 x %struct.my_struct], [2 x %struct.my_struct]* %6, i64 0, i64 1
%20 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %19, i32 0, i32 1
%21 = load double, double* %20
%22 = fadd double %18, %21
store double %22, double* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int alive(int *arr, int lenght) {
  int i;
  for (i = 0; i < lenght; i++) {
    if (arr[i] == 1) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<alive>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114f <alive+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    113c <alive+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1156 <alive+0x56>
jmp    1141 <alive+0x41>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <alive+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<alive>:
test   %esi,%esi
jle    111f <alive+0x1f>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpl   $0x1,(%rdi,%rcx,4)
je     1122 <alive+0x22>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <alive+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @alive(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 1
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %14, label %6
14: ; preds = %8, %6, %2
%15 = phi i32 [ 0, %2 ], [ 0, %6 ], [ 1, %8 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ stderr;
void error(char *o) {
  fprintf(stderr, "tolua: unknown option '%s'\n", o);
  help();
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"tolua: unknown option '%s'\0A\00"
define void @error(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 ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @help()
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"tolua: unknown option '%s'\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @help()
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int system(char const *);
int c_system(const char *arg0) { return system(arg0); }


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

x86 assembly (clang, -O2):
<c_system>:
jmp    1030 <system@plt>

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

LLVM IR (-O2):
define i32 @c_system(i8* nocapture %0) {
%2 = tail call i32 @system(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void idt_int4(void) { print("!! Overflow "); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"!! Overflow \00"
define void @idt_int4() {
%1 = call i32 @print(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"!! Overflow \00"
define void @idt_int4() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    usage(argv[0]);
    exit(EXIT_SUCCESS);
  }
  int x = atoi(argv[1]);
  printf("Hex: %x\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1161 <main+0x21>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    (%rsi),%rdi
call   1040 <usage@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@.str = [9 x i8] c"Hex: %x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @usage(i8* %12)
%14 = load i32, i32* @EXIT_SUCCESS
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@.str = [9 x i8] c"Hex: %x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}