xunge/DecIR huggingface dataset:
__typeof__(strcpy(1, "")) test_strcpy_151(void) { return strcpy(1, ""); }


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

x86 assembly (clang, -O2):
<test_strcpy_151>:
movb   $0x0,0x1
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @test_strcpy_151() {
%1 = call i8* @strcpy(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
define i8* @test_strcpy_151() {
store i8 0, i8* inttoptr (i64 1 to i8*)
ret i8* inttoptr (i64 1 to i8*)
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ tprintf(char *, char *);
FILE *Fwrite(char *filename) {
  FILE *out;
  if ((out = fopen(filename, "w")) == NULL) {
    tprintf("ERROR: The file %s could not opened to write!\n", filename);
    exit(0);
  }
  return (out);
}


x86 assembly (clang, -O0):
<Fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1171 <Fwrite+0x41>
mov    -0x8(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <tprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fwrite>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1147 <Fwrite+0x17>
pop    %rbx
ret
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <tprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [47 x i8] c"ERROR: The file %s could not opened to write!\0A\00"
define i32* @Fwrite(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @tprintf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %1
%12 = load i32*, i32** %3
ret i32* %12
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [47 x i8] c"ERROR: The file %s could not opened to write!\0A\00"
define noalias i32* @Fwrite(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @tprintf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1
ret i32* %2
}
int benchmark_finirun() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @benchmark_finirun() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ make_manual(int /*<<< orphan*/);
void plain_manual_() {
  make_manual(0);
  return;
}


x86 assembly (clang, -O0):
<plain_manual_>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <make_manual@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<plain_manual_>:
xor    %edi,%edi
jmp    1030 <make_manual@plt>

LLVM IR (-O0):
define void @plain_manual_() {
%1 = call i32 @make_manual(i32 0)
ret void
}

LLVM IR (-O2):
define void @plain_manual_() {
%1 = tail call i32 @make_manual(i32 0)
ret void
}
int test_imm_4Cint16_reg(short val) {
  return ((val) & (-0x4C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_4Cint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffffb4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_4Cint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -76
%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_4Cint16_reg(i16 signext %0) {
%2 = and i16 %0, -76
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
unsigned xrop3_61_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = D | S;
  stk3 = ~stk3;
  stk2 = T | stk3;
  stk1 = S ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_61_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_61_0_0>:
mov    %edi,%eax
shl    $0x8,%eax
lea    (%rdi,%rax,1),%ecx
mov    %esi,%edx
shl    $0x8,%edx
or     %esi,%edx
xor    $0xffffff00,%eax
or     %edx,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_61_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = or i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = xor i32 %26, -1
store i32 %27, i32* %10
%28 = load i32, i32* %7
%29 = load i32, i32* %10
%30 = or i32 %28, %29
store i32 %30, i32* %9
%31 = load i32, i32* %6
%32 = load i32, i32* %9
%33 = xor i32 %31, %32
store i32 %33, i32* %8
%34 = load i32, i32* %8
ret i32 %34
}

LLVM IR (-O2):
define i32 @xrop3_61_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = mul nuw nsw i32 %6, 257
%8 = xor i32 %4, -256
%9 = or i32 %7, %8
%10 = xor i32 %9, %5
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int syntax(void) {
  printf("Syntax: avifdump input.avif\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Syntax: avifdump input.avif\0A\00"
define i32 @syntax() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"Syntax: avifdump input.avif\00"
define i32 @syntax() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void foo013() {}


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

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

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

LLVM IR (-O2):
define void @foo013() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int *twoSum(int *, int, int);
int main(int argc, char **argv) {
  int input1[] = {2, 7, 11, 15};
  int *r1 = twoSum(input1, 4, 9);
  assert(r1[0] == 0);
  assert(r1[1] == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
mov    $0x9,%edx
call   1040 <twoSum@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x1,0x4(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x9,%edx
call   1040 <twoSum@plt>
mov    %rax,%rbx
xor    %edi,%edi
cmpl   $0x0,(%rax)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0x4(%rbx)
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.input1 = [4 x i32] [i32 2, i32 7, i32 11, i32 15]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i32]
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [4 x i32]* %6 to i8*
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%10 = call i32* @twoSum(i32* %9, i32 4, i32 9)
store i32* %10, i32** %7
%11 = load i32*, i32** %7
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32*, i32** %7
%18 = getelementptr inbounds i32, i32* %17, i64 1
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.input1 = [4 x i32] [i32 2, i32 7, i32 11, i32 15]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%6 = call i32* @twoSum(i32* %5, i32 4, i32 9)
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds i32, i32* %6, i64 1
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ add(int *, int *);
void inc(int *z) {
  int i;
  i = 1;
  add(z, &i);
}


x86 assembly (clang, -O0):
<inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <add@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @inc(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = call i32 @add(i32* %0, i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c(double, double, double);
double fmax(int /*<<< orphan*/, int /*<<< orphan*/);
double mo(double x, double y) {
  return fmax(c(x + 0.15, y - 0.05, 0.2), -c(x + 0.15, y, 0.25));
}


x86 assembly (clang, -O0):
<mo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xece(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xecc(%rip),%xmm2
subsd  %xmm2,%xmm1
movsd  0xeb8(%rip),%xmm2
call   1030 <c@plt>
mov    %eax,-0x14(%rbp)
movsd  0xea0(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe86(%rip),%xmm2
call   1030 <c@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
sub    %eax,%esi
call   1040 <fmax@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mo>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm1,%xmm2
movsd  %xmm1,0x8(%rsp)
addsd  0xec9(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xec4(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  0xec0(%rip),%xmm2
call   1030 <c@plt>
mov    %eax,%ebx
movsd  0xeb9(%rip),%xmm2
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <c@plt>
neg    %eax
mov    %ebx,%edi
mov    %eax,%esi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <fmax@plt>

LLVM IR (-O0):
define double @mo(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 = fadd double %5, 1.500000e-01
%7 = load double, double* %4
%8 = fsub double %7, 5.000000e-02
%9 = call i32 @c(double %6, double %8, double 2.000000e-01)
%10 = load double, double* %3
%11 = fadd double %10, 1.500000e-01
%12 = load double, double* %4
%13 = call i32 @c(double %11, double %12, double 2.500000e-01)
%14 = sub nsw i32 0, %13
%15 = call double @fmax(i32 %9, i32 %14)
ret double %15
}

LLVM IR (-O2):
define double @mo(double %0, double %1) {
%3 = fadd double %0, 1.500000e-01
%4 = fadd double %1, -5.000000e-02
%5 = tail call i32 @c(double %3, double %4, double 2.000000e-01)
%6 = tail call i32 @c(double %3, double %1, double 2.500000e-01)
%7 = sub nsw i32 0, %6
%8 = tail call double @fmax(i32 %5, i32 %7)
ret double %8
}
void glib_check_version() {}


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

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

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

LLVM IR (-O2):
define void @glib_check_version() {
ret void
}
/* Variables and functions */
int core11_safe(char const *);
int U_EMRINVERTRGN_safe(const char *record) { return (core11_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRINVERTRGN_safe>:
jmp    1030 <core11_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRINVERTRGN_safe(i8* %0) {
%2 = tail call i32 @core11_safe(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ allocate___0(int /*<<< orphan*/);
int main() {
  allocate___0(0);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @allocate___0(i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ MD5_CTX;

/* Variables and functions */
int /*<<< orphan*/ MD5Init(int /*<<< orphan*/ *);
int MD5_Init(MD5_CTX *c) {
  MD5Init(c);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @MD5_Init(i32* %0) {
%2 = tail call i32 @MD5Init(i32* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ writeb_idx_mask(int, int, int, int);
void reset_mode(int secondary) {
  if (!secondary) {
    writeb_idx_mask(0x3d5, 0x11, 0x00, 0x80);
    writeb_idx_mask(0x3d5, 0x03, 0x80, 0x80);
  } else {
  }
}


x86 assembly (clang, -O0):
<reset_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1156 <reset_mode+0x46>
mov    $0x3d5,%edi
mov    $0x11,%esi
xor    %edx,%edx
mov    $0x80,%ecx
call   1030 <writeb_idx_mask@plt>
mov    $0x3d5,%edi
mov    $0x3,%esi
mov    $0x80,%ecx
mov    %ecx,%edx
call   1030 <writeb_idx_mask@plt>
jmp    115b <reset_mode+0x4b>
jmp    115b <reset_mode+0x4b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_mode>:
test   %edi,%edi
je     1115 <reset_mode+0x5>
ret
push   %rax
mov    $0x3d5,%edi
mov    $0x11,%esi
xor    %edx,%edx
mov    $0x80,%ecx
call   1030 <writeb_idx_mask@plt>
mov    $0x3d5,%edi
mov    $0x3,%esi
mov    $0x80,%edx
mov    $0x80,%ecx
pop    %rax
jmp    1030 <writeb_idx_mask@plt>

LLVM IR (-O0):
define void @reset_mode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = call i32 @writeb_idx_mask(i32 981, i32 17, i32 0, i32 128)
%7 = call i32 @writeb_idx_mask(i32 981, i32 3, i32 128, i32 128)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
define void @reset_mode(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @writeb_idx_mask(i32 981, i32 17, i32 0, i32 128)
%5 = tail call i32 @writeb_idx_mask(i32 981, i32 3, i32 128, i32 128)
br label %6
6: ; preds = %1, %3
ret void
}
void check_sync(void) {}


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

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

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

LLVM IR (-O2):
define void @check_sync() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int ski(int *, int);
int main(void) {
  int a[] = {24, 23, 22, 21, 20, 13, 14, 17, 18, 19, 12, 15, 16,
             1,  0,  11, 8,  7,  4,  3,  10, 9,  6,  5,  2};
  printf("%d\n", ski(a, 5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x64,%edx
call   1040 <memcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0x5,%esi
call   1050 <ski@plt>
mov    %eax,%esi
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
mov    0xf36(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xf1b(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeff(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <ski@plt>
lea    0xedb(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [25 x i32] [i32 24, i32 23, i32 22, i32 21, i32 20, i32 13, i32 14, i32 17, i32 18, i32 19, i32 12, i32 15, i32 16, i32 1, i32 0, i32 11, i32 8, i32 7, i32 4, i32 3, i32 10, i32 9, i32 6, i32 5, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i32]
store i32 0, i32* %1
%3 = bitcast [25 x i32]* %2 to i8*
%4 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 0
%5 = call i32 @ski(i32* %4, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [25 x i32] [i32 24, i32 23, i32 22, i32 21, i32 20, i32 13, i32 14, i32 17, i32 18, i32 19, i32 12, i32 15, i32 16, i32 1, i32 0, i32 11, i32 8, i32 7, i32 4, i32 3, i32 10, i32 9, i32 6, i32 5, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [25 x i32]
%2 = bitcast [25 x i32]* %1 to i8*
%3 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 0
%4 = call i32 @ski(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
char *strchr(const char *ptr, int value) { return 0; }


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

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

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

LLVM IR (-O2):
define noalias i8* @strchr(i8* nocapture readnone %0, i32 %1) {
ret i8* null
}
void curl_easy_getinfo() {}


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

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

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

LLVM IR (-O2):
define void @curl_easy_getinfo() {
ret void
}
/* Variables and functions */
char *_get_filename(char *, int /*<<< orphan*/);
char *get_filename(char *spec) { return _get_filename(spec, 0); }


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

x86 assembly (clang, -O2):
<get_filename>:
xor    %esi,%esi
jmp    1030 <_get_filename@plt>

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

LLVM IR (-O2):
define i8* @get_filename(i8* %0) {
%2 = tail call i8* @_get_filename(i8* %0, i32 0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ ft_stabdel(char ***);
int /*<<< orphan*/ ft_strdel(char **);
_Bool check_length_exit(char ***check, char **ret, _Bool out) {
  if (!check)
    return (0);
  ft_stabdel(check);
  ft_strdel(ret);
  return (out);
}


x86 assembly (clang, -O0):
<check_length_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
and    $0x1,%al
mov    %al,-0x19(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <check_length_exit+0x2b>
movb   $0x0,-0x1(%rbp)
jmp    1165 <check_length_exit+0x45>
mov    -0x10(%rbp),%rdi
call   1040 <ft_stabdel@plt>
mov    -0x18(%rbp),%rdi
call   1030 <ft_strdel@plt>
mov    -0x19(%rbp),%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_length_exit>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     113d <check_length_exit+0x1d>
mov    %edx,%ebx
mov    %rsi,%r14
call   1040 <ft_stabdel@plt>
mov    %r14,%rdi
call   1030 <ft_strdel@plt>
jmp    113f <check_length_exit+0x1f>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define zeroext i1 @check_length_exit(i8*** %0, i8** %1, i1 zeroext %2) {
%4 = alloca i1
%5 = alloca i8***
%6 = alloca i8**
%7 = alloca i8
store i8*** %0, i8**** %5
store i8** %1, i8*** %6
%8 = zext i1 %2 to i8
store i8 %8, i8* %7
%9 = load i8***, i8**** %5
%10 = icmp ne i8*** %9, null
br i1 %10, label %12, label %11
11: ; preds = %3
store i1 false, i1* %4
br label %19
12: ; preds = %3
%13 = load i8***, i8**** %5
%14 = call i32 @ft_stabdel(i8*** %13)
%15 = load i8**, i8*** %6
%16 = call i32 @ft_strdel(i8** %15)
%17 = load i8, i8* %7
%18 = trunc i8 %17 to i1
store i1 %18, i1* %4
br label %19
19: ; preds = %12, %11
%20 = load i1, i1* %4
ret i1 %20
}

LLVM IR (-O2):
define zeroext i1 @check_length_exit(i8*** %0, i8** %1, i1 zeroext %2) {
%4 = icmp eq i8*** %0, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @ft_stabdel(i8*** %0)
%7 = tail call i32 @ft_strdel(i8** %1)
br label %8
8: ; preds = %3, %5
%9 = phi i1 [ %2, %5 ], [ false, %3 ]
ret i1 %9
}
int ft_isalpha(int c) {
  if ((c > 64 && c < 91) || (c > 96 && c < 123))
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jle    111b <ft_isalpha+0x1b>
cmpl   $0x5b,-0x8(%rbp)
jl     112f <ft_isalpha+0x2f>
cmpl   $0x60,-0x8(%rbp)
jle    113b <ft_isalpha+0x3b>
cmpl   $0x7b,-0x8(%rbp)
jge    113b <ft_isalpha+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1142 <ft_isalpha+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isalpha>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isalpha(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 64
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 91
br i1 %8, label %15, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 96
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 123
br i1 %14, label %15, label %16
15: ; preds = %12, %6
store i32 1, i32* %2
br label %17
16: ; preds = %12, %9
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @ft_isalpha(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
void foo518(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo518(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printw(char *, int, int);
move(int r, int c) { printw("\e[%d;%dH", r + 1, c + 1); }


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xecf(%rip),%rdi
call   1030 <printw@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
lea    0x1(%rdi),%eax
lea    0x1(%rsi),%edx
lea    0xee3(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printw@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define i32 @move(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = load i32, i32* %5
%9 = add nsw i32 %8, 1
%10 = call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define i32 @move(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = add nsw i32 %1, 1
%5 = tail call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret i32 undef
}
/* Variables and functions */
int BKDRHash(char *s, size_t size) {
  int seed = 31;
  unsigned long hash = 0;
  while (*s != '\0') {
    hash = hash * seed + *s++;
  }
  return hash % size;
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1f,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1156 <BKDRHash+0x56>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    111b <BKDRHash+0x1b>
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112e <BKDRHash+0x2e>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rax,%rdx
shl    $0x5,%rdx
sub    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
jmp    1130 <BKDRHash+0x30>
xor    %eax,%eax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1145 <BKDRHash+0x45>
xor    %edx,%edx
div    %rsi
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @BKDRHash(i8* nocapture %0, i64 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i64 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = mul i64 %7, 31
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = sext i8 %6 to i64
%12 = add i64 %9, %11
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i64 [ 0, %2 ], [ %12, %5 ]
%17 = urem i64 %16, %1
%18 = trunc i64 %17 to i32
ret i32 %18
}
int foo1(int x) { return (float)x != 0; }


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @foo1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
%5 = fcmp une float %4, 0.000000e+00
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @foo1(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
char *strstr(char const *, char *);
const char *in_get_data(const char *data) {
  const char *p = strstr(data, "\r\n\r\n");
  return (p != NULL) ? p + 4 : NULL;
}


x86 assembly (clang, -O0):
<in_get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114c <in_get_data+0x3c>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <in_get_data+0x47>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1157 <in_get_data+0x47>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_get_data>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
lea    0x4(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\0D\0A\0D\0A\00"
define i8* @in_get_data(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strstr(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 4
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %8
%13 = phi i8* [ %10, %8 ], [ null, %11 ]
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0D\0A\0D\0A\00"
define i8* @in_get_data(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 4
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ addstring(char **, int *, int *, char *);
void addchar(char **buf, int *blen, int *maxlen, int c) {
  char tbuf[2];
  tbuf[0] = c;
  tbuf[1] = '\0';
  addstring(buf, blen, maxlen, tbuf);
}


x86 assembly (clang, -O0):
<addchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %al,-0x1e(%rbp)
movb   $0x0,-0x1d(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x1e(%rbp),%rcx
call   1030 <addstring@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addchar>:
push   %rax
mov    %cl,0x6(%rsp)
movb   $0x0,0x7(%rsp)
lea    0x6(%rsp),%rcx
call   1030 <addstring@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @addchar(i8** %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca [2 x i8]
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%7 = trunc i32 %3 to i8
store i8 %7, i8* %6
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %8
%9 = call i32 @addstring(i8** %0, i32* %1, i32* %2, i8* %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void DoClockSc() {
  static unsigned int nbclock = 0;
  time_t now = 0;
  nbclock++;
  time(&now);
}


x86 assembly (clang, -O0):
<DoClockSc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2f07(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2efe(%rip)
lea    -0x4(%rbp),%rdi
call   1030 <time@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoClockSc>:
push   %rax
movl   $0x0,0x4(%rsp)
addl   $0x1,0x2f0c(%rip)
lea    0x4(%rsp),%rdi
call   1030 <time@plt>
pop    %rax
ret

LLVM IR (-O0):
@DoClockSc.nbclock = internal global i32 0
define void @DoClockSc() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @DoClockSc.nbclock
%3 = add i32 %2, 1
store i32 %3, i32* @DoClockSc.nbclock
%4 = call i32 @time(i32* %1)
ret void
}

LLVM IR (-O2):
@DoClockSc.nbclock = internal unnamed_addr global i32 0
define void @DoClockSc() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = load i32, i32* @DoClockSc.nbclock
%4 = add i32 %3, 1
store i32 %4, i32* @DoClockSc.nbclock
%5 = call i32 @time(i32* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ polyglot_array_typeid(int /*<<< orphan*/,
                                         int /*<<< orphan*/);
void *polyglot_from_typed(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ polyglot_i32_typeid();
__attribute__((always_)) void *polyglot_from_i32_array(int32_t *arr,
                                                       uint64_t len) {
  return polyglot_from_typed(arr,
                             polyglot_array_typeid(polyglot_i32_typeid(), len));
}


x86 assembly (clang, -O0):
<polyglot_from_i32_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <polyglot_i32_typeid@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%esi
call   1050 <polyglot_array_typeid@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <polyglot_from_typed@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<polyglot_from_i32_array>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <polyglot_i32_typeid@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1050 <polyglot_array_typeid@plt>
mov    %r14,%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <polyglot_from_typed@plt>

LLVM IR (-O0):
define i8* @polyglot_from_i32_array(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 = call i32 (...) @polyglot_i32_typeid()
%7 = load i32, i32* %4
%8 = call i32 @polyglot_array_typeid(i32 %6, i32 %7)
%9 = call i8* @polyglot_from_typed(i32* %5, i32 %8)
ret i8* %9
}

LLVM IR (-O2):
define i8* @polyglot_from_i32_array(i32* %0, i32 %1) {
%3 = tail call i32 (...) @polyglot_i32_typeid()
%4 = tail call i32 @polyglot_array_typeid(i32 %3, i32 %1)
%5 = tail call i8* @polyglot_from_typed(i32* %0, i32 %4)
ret i8* %5
}
long FlashUserSet(unsigned long ulUser0, unsigned long ulUser1) {
  if (((((*((volatile unsigned long *)(0x400FE000))) & 0x70000000) ==
        0x00000000) ||
       (((*((volatile unsigned long *)(0x400FE000))) &
         (0x70000000 | 0x00FF0000)) == (0x10000000 | 0x00000000)))) {
    return (-1);
  }
  (*((volatile unsigned long *)(0x400FE1E0))) = ulUser0;
  (*((volatile unsigned long *)(0x400FE1E4))) = ulUser1;
  return (0);
}


x86 assembly (clang, -O0):
<FlashUserSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x400fe000,%eax
mov    (%rax),%rax
and    $0x70000000,%rax
cmp    $0x0,%rax
je     113e <FlashUserSet+0x3e>
mov    $0x400fe000,%eax
mov    (%rax),%rax
and    $0x70ff0000,%rax
cmp    $0x10000000,%rax
jne    114b <FlashUserSet+0x4b>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    116b <FlashUserSet+0x6b>
mov    -0x10(%rbp),%rcx
mov    $0x400fe1e0,%eax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    $0x400fe1e4,%eax
mov    %rcx,(%rax)
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashUserSet>:
mov    $0xffffffffffffffff,%rax
testq  $0x70000000,0x400fe000
je     113d <FlashUserSet+0x3d>
mov    0x400fe000,%rcx
40
and    $0x70ff0000,%ecx
cmp    $0x10000000,%ecx
je     113d <FlashUserSet+0x3d>
mov    %rdi,0x400fe1e0
40
mov    %rsi,0x400fe1e4
40
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @FlashUserSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%7 = and i64 %6, 1879048192
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%11 = and i64 %10, 1895759872
%12 = icmp eq i64 %11, 268435456
br i1 %12, label %13, label %14
13: ; preds = %9, %2
store i64 -1, i64* %3
br label %17
14: ; preds = %9
%15 = load i64, i64* %4
store volatile i64 %15, i64* inttoptr (i64 1074782688 to i64*)
%16 = load i64, i64* %5
store volatile i64 %16, i64* inttoptr (i64 1074782692 to i64*)
store i64 0, i64* %3
br label %17
17: ; preds = %14, %13
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
define i64 @FlashUserSet(i64 %0, i64 %1) {
%3 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%4 = and i64 %3, 1879048192
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load volatile i64, i64* inttoptr (i64 1074782208 to i64*)
%8 = and i64 %7, 1895759872
%9 = icmp eq i64 %8, 268435456
br i1 %9, label %11, label %10
10: ; preds = %6
store volatile i64 %0, i64* inttoptr (i64 1074782688 to i64*)
store volatile i64 %1, i64* inttoptr (i64 1074782692 to i64*)
br label %11
11: ; preds = %2, %6, %10
%12 = phi i64 [ 0, %10 ], [ -1, %6 ], [ -1, %2 ]
ret i64 %12
}
/* Variables and functions */
int bar();
int b() { return bar(); }


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

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

LLVM IR (-O0):
define i32 @b() {
%1 = call i32 (...) @bar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @b() {
%1 = tail call i32 (...) @bar()
ret i32 %1
}
/* Variables and functions */
int FD_CLOEXEC;
int /*<<< orphan*/ F_GETFD;
int /*<<< orphan*/ F_SETFD;
int fcntl(int, int /*<<< orphan*/, int);
void set_cloexec(int fd) {
  int flags = fcntl(fd, F_GETFD, 0);
  flags |= FD_CLOEXEC;
  fcntl(fd, F_SETFD, flags);
}


x86 assembly (clang, -O0):
<set_cloexec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cloexec>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2eae(%rip),%rcx
or     (%rcx),%eax
mov    0x2ead(%rip),%rcx
mov    (%rcx),%esi
mov    %ebx,%edi
mov    %eax,%edx
pop    %rbx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_SETFD = global i32 0
define void @set_cloexec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFD
%6 = call i32 @fcntl(i32 %4, i32 %5, i32 0)
store i32 %6, i32* %3
%7 = load i32, i32* @FD_CLOEXEC
%8 = load i32, i32* %3
%9 = or i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* @F_SETFD
%12 = load i32, i32* %3
%13 = call i32 @fcntl(i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@F_GETFD = global i32 0
@FD_CLOEXEC = global i32 0
@F_SETFD = global i32 0
define void @set_cloexec(i32 %0) {
%2 = load i32, i32* @F_GETFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = load i32, i32* @FD_CLOEXEC
%5 = or i32 %4, %3
%6 = load i32, i32* @F_SETFD
%7 = tail call i32 @fcntl(i32 %0, i32 %6, i32 %5)
ret void
}
void swap2x(int *a, int *b) {}


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

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

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

LLVM IR (-O2):
define void @swap2x(i32* nocapture %0, i32* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ localfunc();
int main() {
  int i;
  for (i = 0; i < 100000; i++) {
    localfunc();
  }
  if (0 != 0) {
    return 3;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jge    1148 <main+0x38>
mov    $0x0,%al
call   1030 <localfunc@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x186a0,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <localfunc@plt>
add    $0xffffffff,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100000
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 (...) @localfunc()
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 (...) @localfunc()
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 100000
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __real_par();
int /*<<< orphan*/ printf(char *);
void __wrap_par(void) {
  printf("__wrap_par \n");
  __real_par();
}


x86 assembly (clang, -O0):
<__wrap_par>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <__real_par@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrap_par>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <__real_par@plt>

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

LLVM IR (-O2):
@str = [12 x i8] c"__wrap_par \00"
define void @__wrap_par() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @__real_par()
ret void
}
/* Variables and functions */
scalar_t__ isAlpha(char);
scalar_t__ isNum(char);
int isValidNameChar(char c) {
  return (isAlpha(c) || isNum(c) || (c == '_') || (c == '+'));
}


x86 assembly (clang, -O0):
<isValidNameChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <isAlpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1183 <isValidNameChar+0x63>
movsbl -0x1(%rbp),%edi
call   1030 <isNum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1183 <isValidNameChar+0x63>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x2(%rbp)
je     1183 <isValidNameChar+0x63>
movsbl -0x1(%rbp),%eax
cmp    $0x2b,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isValidNameChar>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
call   1040 <isAlpha@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    1155 <isValidNameChar+0x35>
movsbl %bpl,%r14d
mov    %r14d,%edi
call   1030 <isNum@plt>
cmp    $0x5f,%r14b
je     1155 <isValidNameChar+0x35>
test   %rax,%rax
jne    1155 <isValidNameChar+0x35>
xor    %ebx,%ebx
cmp    $0x2b,%bpl
sete   %bl
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isValidNameChar(i8 signext %0) {
%2 = tail call i64 @isAlpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = tail call i64 @isNum(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = icmp eq i8 %0, 95
%8 = or i1 %7, %6
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = icmp eq i8 %0, 43
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %9, %4, %1
%13 = phi i32 [ 1, %4 ], [ 1, %1 ], [ %11, %9 ]
ret i32 %13
}