xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ erreur(char const *);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ printf(char *);
FILE *ouvrirFichier(const char *chemin, const char *mode,
                    const char *messageErreur) {
  FILE *testFichier;
  testFichier = NULL;
  testFichier = fopen(chemin, mode);
  if (testFichier == NULL) {
    printf("ouvrirFichier : \n");
    erreur(messageErreur);
  }
  return testFichier;
}


x86 assembly (clang, -O0):
<ouvrirFichier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117d <ouvrirFichier+0x4d>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <erreur@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ouvrirFichier>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
call   1050 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1158 <ouvrirFichier+0x28>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <erreur@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"ouvrirFichier : \0A\00"
define i32* @ouvrirFichier(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32* null, i32** %7
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32* @fopen(i8* %8, i8* %9)
store i32* %10, i32** %7
%11 = load i32*, i32** %7
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %6
%16 = call i32 @erreur(i8* %15)
br label %17
17: ; preds = %13, %3
%18 = load i32*, i32** %7
ret i32* %18
}

LLVM IR (-O2):
@str = [17 x i8] c"ouvrirFichier : \00"
define noalias i32* @ouvrirFichier(i8* nocapture %0, i8* nocapture %1, i8* %2) {
%4 = tail call i32* @fopen(i8* %0, i8* %1)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @erreur(i8* %2)
br label %9
9: ; preds = %6, %3
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
long SwapLong(long data) {
  assert(sizeof(long) == 4);
  return (data << 24) | ((data << 8) & 0x00FF0000) |
         ((data >> 24) & 0x000000FF) | ((data >> 8) & 0x0000FF00);
}


x86 assembly (clang, -O0):
<SwapLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
shl    $0x8,%rcx
and    $0xff0000,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
sar    $0x18,%rcx
and    $0xff,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
sar    $0x8,%rcx
and    $0xff00,%rcx
or     %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SwapLong>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <assert@plt>
mov    %rbx,%rax
shl    $0x18,%rax
mov    %ebx,%ecx
shl    $0x8,%ecx
and    $0xff0000,%ecx
or     %rax,%rcx
mov    %ebx,%eax
shr    $0x18,%eax
or     %rcx,%rax
shr    $0x8,%rbx
and    $0xff00,%ebx
or     %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @SwapLong(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @assert(i32 0)
%4 = load i64, i64* %2
%5 = shl i64 %4, 24
%6 = load i64, i64* %2
%7 = shl i64 %6, 8
%8 = and i64 %7, 16711680
%9 = or i64 %5, %8
%10 = load i64, i64* %2
%11 = ashr i64 %10, 24
%12 = and i64 %11, 255
%13 = or i64 %9, %12
%14 = load i64, i64* %2
%15 = ashr i64 %14, 8
%16 = and i64 %15, 65280
%17 = or i64 %13, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @SwapLong(i64 %0) {
%2 = tail call i32 @assert(i32 0)
%3 = shl i64 %0, 24
%4 = shl i64 %0, 8
%5 = and i64 %4, 16711680
%6 = or i64 %5, %3
%7 = lshr i64 %0, 24
%8 = and i64 %7, 255
%9 = or i64 %6, %8
%10 = lshr i64 %0, 8
%11 = and i64 %10, 65280
%12 = or i64 %9, %11
ret i64 %12
}
void XESetEventToWire() {}


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

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

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

LLVM IR (-O2):
define void @XESetEventToWire() {
ret void
}
__attribute__((always_)) __attribute__((always_)) int
constant_test_bit(unsigned int nr, const volatile unsigned long *addr) {
  return ((1UL << (nr % 64)) & (((unsigned long *)addr)[nr / 64])) != 0;
}


x86 assembly (clang, -O0):
<constant_test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%edx
shr    $0x6,%edx
mov    %edx,%edx
and    (%rcx,%rdx,8),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant_test_bit>:
mov    %edi,%eax
shr    $0x6,%eax
mov    (%rsi,%rax,8),%rcx
xor    %eax,%eax
bt     %rdi,%rcx
setb   %al
ret

LLVM IR (-O0):
define i32 @constant_test_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = urem i32 %5, 64
%7 = zext i32 %6 to i64
%8 = shl i64 1, %7
%9 = load i64*, i64** %4
%10 = load i32, i32* %3
%11 = udiv i32 %10, 64
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
%14 = load i64, i64* %13
%15 = and i64 %8, %14
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @constant_test_bit(i32 %0, i64* nocapture %1) {
%3 = and i32 %0, 63
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = lshr i32 %0, 6
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = and i64 %9, %5
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
long SIO1keypressed(int val) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @SIO1keypressed(i32 %0) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = 1, j = -2, k;
  k = !(i >= 0) || !(j >= 00) && !(i <= 0) || !(j <= 0);
  printf("%d", k);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0xfffffffe,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     1161 <main+0x51>
cmpl   $0x0,-0xc(%rbp)
jge    1155 <main+0x45>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jg     1161 <main+0x51>
cmpl   $0x0,-0xc(%rbp)
setle  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 -2, i32* %3
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10, %7
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 0
%16 = xor i1 %15, true
br label %17
17: ; preds = %13, %10, %0
%18 = phi i1 [ true, %10 ], [ true, %0 ], [ %16, %13 ]
%19 = zext i1 %18 to i32
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
void enableLCDBackLight(void) {
  (*(volatile unsigned int *)(0x7F0080A4)) |= (1 << 14);
  return;
}


x86 assembly (clang, -O0):
<enableLCDBackLight>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7f0080a4,%eax
mov    (%rax),%ecx
or     $0x4000,%ecx
mov    $0x7f0080a4,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<enableLCDBackLight>:
orl    $0x4000,0x7f0080a4
ret

LLVM IR (-O0):
define void @enableLCDBackLight() {
%1 = load volatile i32, i32* inttoptr (i64 2130739364 to i32*)
%2 = or i32 %1, 16384
store volatile i32 %2, i32* inttoptr (i64 2130739364 to i32*)
ret void
}

LLVM IR (-O2):
define void @enableLCDBackLight() {
%1 = load volatile i32, i32* inttoptr (i64 2130739364 to i32*)
%2 = or i32 %1, 16384
store volatile i32 %2, i32* inttoptr (i64 2130739364 to i32*)
ret void
}
/* Type definitions */
struct _reent {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int __real___srget_r(struct _reent *ptr, register FILE *fp) { return 0; }


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

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

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

LLVM IR (-O2):
%struct._reent = type { i32 }
define i32 @__real___srget_r(%struct._reent* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 0
}
volatile char *add_endi(volatile char *tgt_addr) {
  (*tgt_addr++) = 0xc9;
  (*tgt_addr++) = 0xc3;
  return (tgt_addr);
}


x86 assembly (clang, -O0):
<add_endi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0xc9,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0xc3,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_endi>:
movb   $0xc9,(%rdi)
movb   $0xc3,0x1(%rdi)
lea    0x2(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @add_endi(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i32 1
store i8* %4, i8** %2
store volatile i8 -55, i8* %3
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
store volatile i8 -61, i8* %5
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
define i8* @add_endi(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
store volatile i8 -55, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 2
store volatile i8 -61, i8* %2
ret i8* %3
}
wrapup() {}


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

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

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

LLVM IR (-O2):
define i32 @wrapup() {
ret i32 undef
}
OP(fd, bb) { op_bb(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <op_bb@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_bb()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void gw_sched_free(void *ptr) { free((char *)ptr); }


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

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

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

LLVM IR (-O2):
define void @gw_sched_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
double interpolate(double start, double end, int numberofsteps) {
  double stepvalue = 0;
  if (numberofsteps == 0)
    return 1;
  stepvalue = (end - start) / numberofsteps;
  return stepvalue;
}


x86 assembly (clang, -O0):
<interpolate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1135 <interpolate+0x35>
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1157 <interpolate+0x57>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolate>:
test   %edi,%edi
je     1118 <interpolate+0x18>
subsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xee0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @interpolate(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
store double 0.000000e+00, double* %8
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
store double 1.000000e+00, double* %4
br label %20
12: ; preds = %3
%13 = load double, double* %6
%14 = load double, double* %5
%15 = fsub double %13, %14
%16 = load i32, i32* %7
%17 = sitofp i32 %16 to double
%18 = fdiv double %15, %17
store double %18, double* %8
%19 = load double, double* %8
store double %19, double* %4
br label %20
20: ; preds = %12, %11
%21 = load double, double* %4
ret double %21
}

LLVM IR (-O2):
define double @interpolate(double %0, double %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = fsub double %1, %0
%7 = sitofp i32 %2 to double
%8 = fdiv double %6, %7
br label %9
9: ; preds = %3, %5
%10 = phi double [ %8, %5 ], [ 1.000000e+00, %3 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ __emit_expression_range(int /*<<< orphan*/, int);
void test_within_macro_2(int lhs, int rhs) {
  __emit_expression_range(0, lhs == rhs);
}


x86 assembly (clang, -O0):
<test_within_macro_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
xor    %edi,%edi
call   1030 <__emit_expression_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_within_macro_2>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
xor    %edi,%edi
mov    %eax,%esi
jmp    1030 <__emit_expression_range@plt>

LLVM IR (-O0):
define void @test_within_macro_2(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 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @__emit_expression_range(i32 0, i32 %8)
ret void
}

LLVM IR (-O2):
define void @test_within_macro_2(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @__emit_expression_range(i32 0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
void getFilename(char *psFilename) {
  printf("File Name: ");
  scanf("%1024s", psFilename);
}


x86 assembly (clang, -O0):
<getFilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFilename>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"File Name: \00"
@.str.1 = [7 x i8] c"%1024s\00"
define void @getFilename(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"File Name: \00"
@.str.1 = [7 x i8] c"%1024s\00"
define void @getFilename(i8* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
void btp_location_add_ext(int *line, int *column, int add_line,
                          int add_column) {
  if (add_line > 1) {
    *line += add_line - 1;
    *column = add_column;
  } else
    *column += add_column;
}


x86 assembly (clang, -O0):
<btp_location_add_ext>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x1,-0x14(%rbp)
jle    1138 <btp_location_add_ext+0x38>
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1143 <btp_location_add_ext+0x43>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<btp_location_add_ext>:
cmp    $0x2,%edx
jl     1111 <btp_location_add_ext+0x11>
mov    (%rdi),%eax
add    %edx,%eax
add    $0xffffffff,%eax
mov    %eax,(%rdi)
mov    %ecx,(%rsi)
ret
add    (%rsi),%ecx
mov    %ecx,(%rsi)
ret

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

LLVM IR (-O2):
define void @btp_location_add_ext(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 1
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = add nsw i32 %2, -1
%8 = load i32, i32* %0
%9 = add nsw i32 %7, %8
store i32 %9, i32* %0
br label %13
10: ; preds = %4
%11 = load i32, i32* %1
%12 = add nsw i32 %11, %3
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ %12, %10 ], [ %3, %6 ]
store i32 %14, i32* %1
ret void
}
void XTextExtents16() {}


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

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

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

LLVM IR (-O2):
define void @XTextExtents16() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  char *c = "Hello";
  printf(c);
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int is_event_device(const struct dirent *d) {
  return strncmp("event", d->d_name, strlen("event")) == 0;
}


x86 assembly (clang, -O0):
<is_event_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xec4(%rip),%rdi
call   1040 <strlen@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xeb3(%rip),%rdi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_event_device>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%ebx
lea    0xed3(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@.str = [6 x i8] c"event\00"
define i32 @is_event_device(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str = [6 x i8] c"event\00"
define i32 @is_event_device(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
int test_imm_29uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x29 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_29uint64_highword_reg>:
movabs $0x2900000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_29uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 41
%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_29uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 176093659136
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ errno;
int _read(int file, char *ptr, int len) {
  switch (file) {
  default:
    errno = EBADF;
    return -1;
  }
}


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec2(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EBADF = global i32 0
@errno = global i32 0
define i32 @_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
switch i32 %7, label %8 [
]
8: ; preds = %3
%9 = load i32, i32* @EBADF
store i32 %9, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EBADF = global i32 0
@errno = global i32 0
define i32 @_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @EBADF
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int core4_swap(char *, int);
int U_EMRSTROKEPATH_swap(char *record, int torev) {
  return (core4_swap(record, torev));
}


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

x86 assembly (clang, -O2):
<U_EMRSTROKEPATH_swap>:
jmp    1030 <core4_swap@plt>

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

LLVM IR (-O2):
define i32 @U_EMRSTROKEPATH_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core4_swap(i8* %0, i32 %1)
ret i32 %3
}
char *strsignal(int sig) { return ""; }


x86 assembly (clang, -O0):
<strsignal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsignal>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @strsignal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @strsignal(i32 %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ getStr(char *, int);
int /*<<< orphan*/ puts(char *);
void getInformation(void) {
  char introduce[100];
  char name[40];
  puts("The name of you shop:");
  getStr(name, 40);
  puts("Give me the introduce of shop");
  getStr(introduce, 112);
}


x86 assembly (clang, -O0):
<getInformation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x28,%esi
call   1040 <getStr@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
mov    $0x70,%esi
call   1040 <getStr@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInformation>:
sub    $0x98,%rsp
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x28,%esi
call   1040 <getStr@plt>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0x30(%rsp),%rdi
mov    $0x70,%esi
call   1040 <getStr@plt>
add    $0x98,%rsp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"The name of you shop:\00"
@.str.1 = [30 x i8] c"Give me the introduce of shop\00"
define void @getInformation() {
%1 = alloca [100 x i8]
%2 = alloca [40 x i8]
%3 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%5 = call i32 @getStr(i8* %4, i32 40)
%6 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%8 = call i32 @getStr(i8* %7, i32 112)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"The name of you shop:\00"
@.str.1 = [30 x i8] c"Give me the introduce of shop\00"
define void @getInformation() {
%1 = alloca [100 x i8]
%2 = alloca [40 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @getStr(i8* %4, i32 40)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @getStr(i8* %3, i32 112)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ list_paths();
void do_list(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  list_paths();
}


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

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

LLVM IR (-O0):
define void @do_list(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 = call i32 (...) @list_paths()
ret void
}

LLVM IR (-O2):
define void @do_list(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @list_paths()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ keywords;
typedef int int64_t;

/* Variables and functions */
int match_words(char const *, char const *, char const **, int const);
int64_t match_config_keyword(const char *str, const char *beginning_of_line) {
  static const char *keywords[] = {
      "true",
      "false",
  };
  static const int64_t keyword_count = sizeof(keywords) / sizeof(keywords[0]);
  return match_words(str, beginning_of_line, keywords, keyword_count);
}


x86 assembly (clang, -O0):
<match_config_keyword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0x2f01(%rip),%rdx
mov    $0x2,%ecx
call   1030 <match_words@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_config_keyword>:
lea    0x2f19(%rip),%rdx
mov    $0x2,%ecx
jmp    1030 <match_words@plt>

LLVM IR (-O0):
@match_config_keyword.keywords = internal global [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
@match_config_keyword.keyword_count = internal constant i32 2
define i32 @match_config_keyword(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @match_words(i8* %5, i8* %6, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @match_config_keyword.keywords, i64 0, i64 0), i32 2)
ret i32 %7
}

LLVM IR (-O2):
@match_config_keyword.keywords = internal global [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i32 @match_config_keyword(i8* %0, i8* %1) {
%3 = tail call i32 @match_words(i8* %0, i8* %1, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @match_config_keyword.keywords, i64 0, i64 0), i32 2)
ret i32 %3
}
int test_imm_D3int64_lowword_mem(long long *val) {
  return ((*val) & (0xD3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D3int64_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, 211
%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_D3int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 211
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int wint_t;

/* Variables and functions */
int wctob(wint_t c) { return c; }


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

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

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

LLVM IR (-O2):
define i32 @wctob(i32 returned %0) {
ret i32 %0
}
void ifx_ppa_pwm_deactivate_module(void) {}


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

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

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

LLVM IR (-O2):
define void @ifx_ppa_pwm_deactivate_module() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ check_write(int, unsigned char, char *);
void outb(unsigned char value, unsigned short int port) {
  check_write((int)port, value, "outb");
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%edi
lea    0xed0(%rip),%rdx
movzbl -0x1(%rbp),%esi
call   1030 <check_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb>:
mov    %edi,%eax
lea    0xee7(%rip),%rdx
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <check_write@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"outb\00"
define void @outb(i8 zeroext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = load i8, i8* %3
%8 = call i32 @check_write(i32 %6, i8 zeroext %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"outb\00"
define void @outb(i8 zeroext %0, i16 zeroext %1) {
%3 = zext i16 %1 to i32
%4 = tail call i32 @check_write(i32 %3, i8 zeroext %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ lcd_print_char(int /*<<< orphan*/);
void lcd_print_string(char *message) {
  do {
    lcd_print_char((uint8_t)*message++);
  } while (*message != '\0');
}


x86 assembly (clang, -O0):
<lcd_print_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <lcd_print_char@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    111c <lcd_print_string+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @lcd_print_string(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %3, %1
%4 = phi i8 [ %2, %1 ], [ %9, %3 ]
%5 = phi i8* [ %0, %1 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = sext i8 %4 to i32
%8 = tail call i32 @lcd_print_char(i32 %7)
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3
ret void
}
/* Variables and functions */
int fcntl(int, int, int);
int /*<<< orphan*/ unix_error(char *);
int Fcntl(int fd, int cmd, int arg) {
  int n;
  if ((n = fcntl(fd, cmd, arg)) == -1)
    unix_error("fcntl error");
  return n;
}


x86 assembly (clang, -O0):
<Fcntl>:
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
mov    -0xc(%rbp),%edx
call   1030 <fcntl@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    1157 <Fcntl+0x37>
lea    0xeae(%rip),%rdi
call   1040 <unix_error@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fcntl>:
push   %rbx
call   1030 <fcntl@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1139 <Fcntl+0x19>
lea    0xecc(%rip),%rdi
call   1040 <unix_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"fcntl error\00"
define i32 @Fcntl(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @fcntl(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
@.str = [12 x i8] c"fcntl error\00"
define i32 @Fcntl(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @fcntl(i32 %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @unix_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
int open(const char *file, int flags, ...) { return -1; }


x86 assembly (clang, -O0):
<open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @open(i8* %0, i32 %1, ...) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret i32 -1
}

LLVM IR (-O2):
define i32 @open(i8* nocapture readnone %0, i32 %1, ...) {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
scalar_t__ strlen(char const *);
FILE *open_default(const char *base_path) {
  char path[strlen(base_path) + strlen(".env") + 1];
  sprintf(path, "%s/.env", base_path);
  return fopen(path, "rb");
}


x86 assembly (clang, -O0):
<open_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rcx
mov    %rax,%rdx
lea    0x1(%rcx,%rdx,1),%rax
mov    %rsp,%rsi
mov    %rsi,-0x10(%rbp)
lea    0x10(%rcx,%rdx,1),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x20(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xe73(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1040 <fopen@plt>
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_default>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rsp,%rbx
add    $0x14,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fopen@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".env\00"
@.str.1 = [8 x i8] c"%s/.env\00"
@.str.2 = [3 x i8] c"rb\00"
define i32* @open_default(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = add nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i8, i64 %9
store i64 %9, i64* %4
%12 = load i8*, i8** %2
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = load i8*, i8** %3
ret i32* %14
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%s/.env\00"
@.str.2 = [3 x i8] c"rb\00"
define noalias i32* @open_default(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 5
%4 = alloca i8, i64 %3
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32* %6
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdup(const char *s) {
  char *new;
  if ((new = malloc(strlen(s) + 1)))
    strcpy(new, s);
  return new;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     116c <strdup+0x3c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
br label %13
13: ; preds = %9, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
int test_imm_87uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x87 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_87uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 135
%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_87uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 8847360
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ fatal_error(char *, char const *, ...);
int /*<<< orphan*/ strerror(scalar_t__);
void fatal_perror(const char *errmsg) {
  if (errno != 0)
    fatal_error("%s: %s", errmsg, strerror(errno));
  else
    fatal_error("%s", errmsg);
}


x86 assembly (clang, -O0):
<fatal_perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
cmpq   $0x0,(%rax)
je     116d <fatal_perror+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%rdi
call   1040 <strerror@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <fatal_error@plt>
jmp    117f <fatal_perror+0x5f>
mov    -0x8(%rbp),%rsi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <fatal_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatal_perror>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     114c <fatal_perror+0x2c>
call   1040 <strerror@plt>
lea    0xec1(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fatal_error@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fatal_error@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [7 x i8] c"%s: %s\00"
@.str.1 = [3 x i8] c"%s\00"
define void @fatal_perror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i64, i64* @errno
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = load i64, i64* @errno
%8 = call i32 @strerror(i64 %7)
%9 = call i32 (i8*, i8*, ...) @fatal_error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %8)
br label %13
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 (i8*, i8*, ...) @fatal_error(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %5
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [7 x i8] c"%s: %s\00"
@.str.1 = [3 x i8] c"%s\00"
define void @fatal_perror(i8* %0) {
%2 = load i64, i64* @errno
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @strerror(i64 %2)
%6 = tail call i32 (i8*, i8*, ...) @fatal_error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5)
br label %9
7: ; preds = %1
%8 = tail call i32 (i8*, i8*, ...) @fatal_error(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %4
ret void
}