xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
char *malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char *p;
  p = malloc(100);
  if (p == NULL) {
    perror("getheap");
    exit(1);
  }
  printf("%p\n", p);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1185 <main+0x45>
lea    0xe8a(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x64,%edi
call   1040 <malloc@plt>
test   %rax,%rax
jne    1166 <main+0x26>
lea    0xea9(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"getheap\00"
@.str.1 = [4 x i8] c"%p\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%10 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int e(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @e() {
ret i32 0
}
/* Variables and functions */
scalar_t__ floor(size_t);
size_t growSize(size_t oldSize) {
  return oldSize + (size_t)floor(oldSize * 0.21f);
}


x86 assembly (clang, -O0):
<growSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x10(%rbp)
test   %rax,%rax
movss  %xmm0,-0xc(%rbp)
js     115d <growSize+0x4d>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe96(%rip),%xmm1
mulss  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttss2si %xmm1,%rdi
mov    %rdi,%rcx
sar    $0x3f,%rcx
movss  0xe7f(%rip),%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rdi
call   1030 <floor@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<growSize>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
js     1120 <growSize+0x10>
cvtsi2ss %rbx,%xmm0
jmp    1137 <growSize+0x27>
mov    %rbx,%rax
shr    %rax
mov    %ebx,%ecx
and    $0x1,%ecx
or     %rax,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
mulss  0xec1(%rip),%xmm0
cvttss2si %xmm0,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subss  0xeb1(%rip),%xmm0
cvttss2si %xmm0,%rdi
and    %rcx,%rdi
or     %rax,%rdi
call   1030 <floor@plt>
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @growSize(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = uitofp i64 %4 to float
%6 = fmul float %5, 0x3FCAE147A0000000
%7 = fptoui float %6 to i64
%8 = call i64 @floor(i64 %7)
%9 = add i64 %3, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @growSize(i64 %0) {
%2 = uitofp i64 %0 to float
%3 = fmul float %2, 0x3FCAE147A0000000
%4 = fptoui float %3 to i64
%5 = tail call i64 @floor(i64 %4)
%6 = add i64 %5, %0
ret i64 %6
}
/* Type definitions */
struct SPARAMETERS {
  int dummy;
};
struct NETWORK {
  int dummy;
};

/* Variables and functions */
int search_link_failure(struct NETWORK *, int, struct SPARAMETERS *, int, int,
                        int);
int get_wave_status(struct NETWORK *NTW, int fiber, int wave,
                    struct SPARAMETERS *SM_Parameters, int dest, int ndr) {
  int jj, wave_status, INITIAL_FIBER;
  wave_status = 0;
  wave_status = search_link_failure(NTW, fiber, SM_Parameters, wave, dest, ndr);
  return wave_status;
}


x86 assembly (clang, -O0):
<get_wave_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
call   1030 <search_link_failure@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_wave_status>:
mov    %edx,%eax
mov    %rcx,%rdx
mov    %eax,%ecx
jmp    1030 <search_link_failure@plt>

LLVM IR (-O0):
%struct.NETWORK = type { i32 }
%struct.SPARAMETERS = type { i32 }
define i32 @get_wave_status(%struct.NETWORK* %0, i32 %1, i32 %2, %struct.SPARAMETERS* %3, i32 %4, i32 %5) {
%7 = alloca %struct.NETWORK*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.SPARAMETERS*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.NETWORK* %0, %struct.NETWORK** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store %struct.SPARAMETERS* %3, %struct.SPARAMETERS** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %14
%16 = load %struct.NETWORK*, %struct.NETWORK** %7
%17 = load i32, i32* %8
%18 = load %struct.SPARAMETERS*, %struct.SPARAMETERS** %10
%19 = load i32, i32* %9
%20 = load i32, i32* %11
%21 = load i32, i32* %12
%22 = call i32 @search_link_failure(%struct.NETWORK* %16, i32 %17, %struct.SPARAMETERS* %18, i32 %19, i32 %20, i32 %21)
store i32 %22, i32* %14
%23 = load i32, i32* %14
ret i32 %23
}

LLVM IR (-O2):
%struct.NETWORK = type { i32 }
%struct.SPARAMETERS = type { i32 }
define i32 @get_wave_status(%struct.NETWORK* %0, i32 %1, i32 %2, %struct.SPARAMETERS* %3, i32 %4, i32 %5) {
%7 = tail call i32 @search_link_failure(%struct.NETWORK* %0, i32 %1, %struct.SPARAMETERS* %3, i32 %2, i32 %4, i32 %5)
ret i32 %7
}
int bitInvertAndInvertwith(int sourceWord, int destinationWord) {
  return (~sourceWord) & (~destinationWord);
}


x86 assembly (clang, -O0):
<bitInvertAndInvertwith>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitInvertAndInvertwith>:
mov    %edi,%eax
or     %esi,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @bitInvertAndInvertwith(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 = xor i32 %5, -1
%7 = load i32, i32* %4
%8 = xor i32 %7, -1
%9 = and i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @bitInvertAndInvertwith(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = xor i32 %3, -1
ret i32 %4
}
void gpio_init() {}


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

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

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

LLVM IR (-O2):
define void @gpio_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *);
int *ivector(long nl, long nh) {
  int *v;
  v = (int *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(int)));
  if (!v) {
    printf("allocation failure in ivector()");
    exit(1);
  }
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117e <ivector+0x4e>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %rbx
mov    %rdi,%rbx
sub    %rdi,%rsi
lea    0x8(,%rsi,4),%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     1156 <ivector+0x26>
shl    $0x2,%rbx
sub    %rbx,%rax
add    $0x4,%rax
pop    %rbx
ret
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 4
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %5
%14 = load i32*, i32** %5
%15 = icmp ne i32* %14, null
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i32*, i32** %5
%21 = load i64, i64* %3
%22 = sub i64 0, %21
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = getelementptr inbounds i32, i32* %23, i64 1
ret i32* %24
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 2
%5 = add i64 %4, 8
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = inttoptr i64 %6 to i32*
%13 = sub i64 0, %0
%14 = getelementptr inbounds i32, i32* %12, i64 %13
%15 = getelementptr inbounds i32, i32* %14, i64 1
ret i32* %15
}
__float128 from_uns_int_load_n(unsigned int *a, long n) {
  return (__float128)a[n];
}


x86 assembly (clang, -O0):
<from_uns_int_load_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1130 <__floatunsitf>
add    $0x10,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<from_uns_int_load_n>:
push   %rax
mov    (%rdi,%rsi,4),%edi
call   1110 <__floatunsitf>
pop    %rax
ret
nopl   0x0(%rax,%rax,1)

LLVM IR (-O0):
define fp128 @from_uns_int_load_n(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 = load i64, i64* %4
%7 = getelementptr inbounds i32, i32* %5, i64 %6
%8 = load i32, i32* %7
%9 = uitofp i32 %8 to fp128
ret fp128 %9
}

LLVM IR (-O2):
define fp128 @from_uns_int_load_n(i32* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 %1
%4 = load i32, i32* %3
%5 = uitofp i32 %4 to fp128
ret fp128 %5
}
int test_imm_95int16_reg(short val) {
  return ((val) & (0x95 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_95int16_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, 149
%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_95int16_reg(i16 signext %0) {
%2 = and i16 %0, 149
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
float byteorder_swapf32(float f) {
  unsigned char c, *a;
  a = (unsigned char *)&f;
  c = a[3];
  a[3] = a[0];
  a[0] = c;
  c = a[2];
  a[2] = a[1];
  a[1] = c;
  return f;
}


x86 assembly (clang, -O0):
<byteorder_swapf32>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0x5(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x5(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x5(%rbp)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x5(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<byteorder_swapf32>:
movd   %xmm0,%eax
bswap  %eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
define float @byteorder_swapf32(float %0) {
%2 = alloca float
%3 = alloca i8
%4 = alloca i8*
store float %0, float* %2
%5 = bitcast float* %2 to i8*
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 3
%8 = load i8, i8* %7
store i8 %8, i8* %3
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 3
store i8 %11, i8* %13
%14 = load i8, i8* %3
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 0
store i8 %14, i8* %16
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8, i8* %18
store i8 %19, i8* %3
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 2
store i8 %22, i8* %24
%25 = load i8, i8* %3
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 1
store i8 %25, i8* %27
%28 = load float, float* %2
ret float %28
}

LLVM IR (-O2):
define float @byteorder_swapf32(float %0) {
%2 = bitcast float %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = bitcast i32 %3 to float
ret float %4
}
/* Type definitions */
typedef int wchar_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
size_t wcslen(const wchar_t *s) {
  const wchar_t *p = s;
  size_t res = 0;
  assert(s != NULL);
  while (*p != L'\0') {
    p++;
    res++;
  }
  return res;
}


x86 assembly (clang, -O0):
<wcslen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1168 <wcslen+0x58>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113e <wcslen+0x2e>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcslen>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
cmpl   $0x0,(%rbx)
je     1140 <wcslen+0x30>
xor    %ecx,%ecx
nopl   0x0(%rax)
lea    0x1(%rcx),%rax
cmpl   $0x0,0x4(%rbx,%rcx,4)
mov    %rax,%rcx
jne    1130 <wcslen+0x20>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @wcslen(i32* %0) {
%2 = icmp ne i32* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = load i32, i32* %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %7
%8 = phi i64 [ %11, %7 ], [ 0, %1 ]
%9 = phi i32* [ %10, %7 ], [ %0, %1 ]
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = add i64 %8, 1
%12 = load i32, i32* %10
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %1
%15 = phi i64 [ 0, %1 ], [ %11, %7 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int main() {
  char *argvs[] = {"ps", "-ef", NULL};
  execv("/bin/ps", argvs);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x2cf5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cd9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ps\00"
@.str.1 = [4 x i8] c"-ef\00"
@__const.main.argvs = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str.2 = [8 x i8] c"/bin/ps\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
store i32 0, i32* %1
%3 = bitcast [3 x i8*]* %2 to i8*
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%5 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ps\00"
@.str.1 = [4 x i8] c"-ef\00"
@__const.main.argvs = [3 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str.2 = [8 x i8] c"/bin/ps\00"
define i32 @main() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
%4 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int fileOpener(FILE **file, char *fileName) {
  *file = fopen(fileName, "r");
  if (*file == NULL) {
    printf("Error: cannot open file.\n");
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<fileOpener>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1170 <fileOpener+0x50>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1177 <fileOpener+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileOpener>:
push   %rbx
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0xed2(%rip),%rsi
mov    %rax,%rdi
call   1040 <fopen@plt>
mov    %rax,%rcx
mov    %rax,(%rbx)
mov    $0x1,%eax
test   %rcx,%rcx
je     1148 <fileOpener+0x28>
pop    %rbx
ret
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@str = [25 x i8] c"Error: cannot open file.\00"
define i32 @fileOpener(i32** nocapture writeonly %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %3, i32** %0
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ 1, %2 ]
ret i32 %8
}
int test_imm_B5uint8_reg(unsigned char val) {
  return ((val) & (0xB5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B5uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 181
%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_B5uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -75
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
char *getfn(int id, char *suffix) {
  static char fn[1000];
  sprintf(fn, "run%03d.%s", id, suffix);
  return (fn);
}


x86 assembly (clang, -O0):
<getfn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0x2f13(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2f00(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfn>:
push   %rbx
mov    %rsi,%rcx
mov    %edi,%edx
lea    0x2f23(%rip),%rbx
lea    0xedc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@getfn.fn = internal global [1000 x i8] zeroinitializer
@.str = [11 x i8] c"run%03d.%s\00"
define i8* @getfn(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 @sprintf(i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @getfn.fn, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %6)
ret i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @getfn.fn, i64 0, i64 0)
}

LLVM IR (-O2):
@getfn.fn = internal global [1000 x i8] zeroinitializer
@.str = [11 x i8] c"run%03d.%s\00"
define i8* @getfn(i32 %0, i8* %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1000 x i8], [1000 x i8]* @getfn.fn, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
ret i8* getelementptr inbounds ([1000 x i8], [1000 x i8]* @getfn.fn, i64 0, i64 0)
}
char *hash_plugin_summary(void) {
  return ("bitcoin \tA Bitcoin mining plugin");
}


x86 assembly (clang, -O0):
<hash_plugin_summary>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [33 x i8] c"bitcoin \09A Bitcoin mining plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [33 x i8] c"bitcoin \09A Bitcoin mining plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0)
}
int test_imm_58int16_mem(short *val) {
  return ((*val) & (-0x58 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_58int16_mem>:
movzwl (%rdi),%eax
test   $0xffa8,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_58int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -88
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_mutex_lock() {
  printf("NOT IMPLEMENTED:"
         "pa_mutex_lock"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [30 x i8] c"NOT IMPLEMENTED:pa_mutex_lock\00"
define i32 @pa_mutex_lock() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _free(void **p) {
  if (*p != NULL) {
    free(*p);
    *p = NULL;
  }
}


x86 assembly (clang, -O0):
<_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1141 <_free+0x31>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <_free+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @_free(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
%9 = call i32 @free(i8* %8)
%10 = load i8**, i8*** %2
store i8* null, i8** %10
br label %11
11: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @_free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ write_line(char *, int, int);
void write_score(int x, int y, int score) {
  char string[4];
  sprintf(string, "%d", score);
  write_line(string, x, y);
}


x86 assembly (clang, -O0):
<write_score>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xec1(%rip),%rsi
call   1030 <sprintf@plt>
lea    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <write_line@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_score>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xecd(%rip),%rsi
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1030 <sprintf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <write_line@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @write_score(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%9 = load i32, i32* %6
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @write_line(i8* %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @write_score(i32 %0, i32 %1, i32 %2) {
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%7 = call i32 @write_line(i8* %5, i32 %0, i32 %1)
ret void
}
/* Type definitions */
struct sigevent {
  int dummy;
};
struct aiocb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int lio_listio(int mode, struct aiocb *const list[], int nent,
               struct sigevent *sig) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<lio_listio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lio_listio>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.aiocb = type { i32 }
%struct.sigevent = type { i32 }
@ENOSYS = global i32 0
define i32 @lio_listio(i32 %0, %struct.aiocb** %1, i32 %2, %struct.sigevent* %3) {
%5 = alloca i32
%6 = alloca %struct.aiocb**
%7 = alloca i32
%8 = alloca %struct.sigevent*
store i32 %0, i32* %5
store %struct.aiocb** %1, %struct.aiocb*** %6
store i32 %2, i32* %7
store %struct.sigevent* %3, %struct.sigevent** %8
%9 = load i32, i32* @ENOSYS
%10 = call i32 @__set_errno(i32 %9)
ret i32 -1
}

LLVM IR (-O2):
%struct.aiocb = type { i32 }
%struct.sigevent = type { i32 }
@ENOSYS = global i32 0
define i32 @lio_listio(i32 %0, %struct.aiocb** nocapture readnone %1, i32 %2, %struct.sigevent* nocapture readnone %3) {
%5 = load i32, i32* @ENOSYS
%6 = tail call i32 @__set_errno(i32 %5)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ OAL_CREATE_SEMAPHORE();
signed int fc8180_ppi_init(void *handle, unsigned short param1,
                           unsigned short param2) {
  OAL_CREATE_SEMAPHORE();
  return 0;
}


x86 assembly (clang, -O0):
<fc8180_ppi_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <OAL_CREATE_SEMAPHORE@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fc8180_ppi_init(i8* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = call i32 (...) @OAL_CREATE_SEMAPHORE()
ret i32 0
}

LLVM IR (-O2):
define i32 @fc8180_ppi_init(i8* nocapture readnone %0, i16 zeroext %1, i16 zeroext %2) {
%4 = tail call i32 (...) @OAL_CREATE_SEMAPHORE()
ret i32 0
}
/* Variables and functions */
scalar_t__ starts_with(char *, char *);
int fix_home(char *in_path) {
  if (starts_with(in_path, "/d4m/home/"))
    return sizeof("/d4m") - 1;
  if (starts_with(in_path, "/nfs/emc5/home/"))
    return sizeof("/nfs/emc5") - 1;
  return 0;
}


x86 assembly (clang, -O0):
<fix_home>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <starts_with@plt>
cmp    $0x0,%rax
je     1142 <fix_home+0x32>
movl   $0x4,-0x4(%rbp)
jmp    116f <fix_home+0x5f>
mov    -0x10(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <starts_with@plt>
cmp    $0x0,%rax
je     1168 <fix_home+0x58>
movl   $0x9,-0x4(%rbp)
jmp    116f <fix_home+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_home>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <starts_with@plt>
mov    %rax,%rcx
mov    $0x4,%eax
test   %rcx,%rcx
je     112f <fix_home+0x1f>
pop    %rbx
ret
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <starts_with@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,8),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"/d4m/home/\00"
@.str.1 = [16 x i8] c"/nfs/emc5/home/\00"
define i32 @fix_home(i8* %0) {
%2 = tail call i64 @starts_with(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @starts_with(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i32 0, i32 9
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 4, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ uart_deinit();
void at_engine_deinit(void) { uart_deinit(); }


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

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

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

LLVM IR (-O2):
define void @at_engine_deinit() {
%1 = tail call i32 (...) @uart_deinit()
ret void
}
int test_imm_DDuint8_mem(unsigned char *val) {
  return ((*val) & (-0xDD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DDuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 35
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ PATH_MAX;
char *getcwd(int /*<<< orphan*/, int /*<<< orphan*/);
char *getlogin();
int /*<<< orphan*/ malloc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *);
void print_prompt() {
  char *curdir = getcwd(malloc(PATH_MAX), PATH_MAX);
  printf("%s:%s=> ", getlogin(), curdir);
}


x86 assembly (clang, -O0):
<print_prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1050 <malloc@plt>
mov    %eax,%edi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
call   1040 <getcwd@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getlogin@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_prompt>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%edi
call   1050 <malloc@plt>
mov    (%rbx),%esi
mov    %eax,%edi
call   1040 <getcwd@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <getlogin@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [9 x i8] c"%s:%s=> \00"
define void @print_prompt() {
%1 = alloca i8*
%2 = load i32, i32* @PATH_MAX
%3 = call i32 @malloc(i32 %2)
%4 = load i32, i32* @PATH_MAX
%5 = call i8* @getcwd(i32 %3, i32 %4)
store i8* %5, i8** %1
%6 = call i8* (...) @getlogin()
%7 = load i8*, i8** %1
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
ret void
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [9 x i8] c"%s:%s=> \00"
define void @print_prompt() {
%1 = load i32, i32* @PATH_MAX
%2 = tail call i32 @malloc(i32 %1)
%3 = load i32, i32* @PATH_MAX
%4 = tail call i8* @getcwd(i32 %2, i32 %3)
%5 = tail call i8* (...) @getlogin()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %4)
ret void
}
/* Variables and functions */
char *find_data(char *data) {
  while (*data != '\0') {
    if (*data >= '0' && *data <= '9')
      return data;
    data++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<find_data>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1156 <find_data+0x56>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1145 <find_data+0x45>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     1145 <find_data+0x45>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115e <find_data+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <find_data+0x8>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_data>:
mov    (%rdi),%cl
test   %cl,%cl
je     1124 <find_data+0x24>
mov    %rdi,%rax
nopl   0x0(%rax)
add    $0xd0,%cl
cmp    $0xa,%cl
jb     1126 <find_data+0x26>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <find_data+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @find_data(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = add i8 %5, -48
%8 = icmp ult i8 %7, 10
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ null, %1 ], [ null, %9 ], [ %6, %4 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ _IO(char, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
void trace_clr() {
  int fd;
  fd = open("/dev/hapara_trace", O_RDWR);
  if (fd == -1)
    return;
  ioctl(fd, _IO('t', 0));
  close(fd);
}


x86 assembly (clang, -O0):
<trace_clr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xea8(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    116f <trace_clr+0x2f>
jmp    1193 <trace_clr+0x53>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x74,%edi
xor    %esi,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
mov    -0x4(%rbp),%edi
call   1050 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace_clr>:
push   %rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     117a <trace_clr+0x3a>
mov    %eax,%ebx
mov    $0x74,%edi
xor    %esi,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <close@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"/dev/hapara_trace\00"
@O_RDWR = global i32 0
define void @trace_clr() {
%1 = alloca i32
%2 = load i32, i32* @O_RDWR
%3 = call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %7
6: ; preds = %0
br label %13
7: ; preds = %0
%8 = load i32, i32* %1
%9 = call i32 @_IO(i8 signext 116, i32 0)
%10 = call i32 @ioctl(i32 %8, i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @close(i32 %11)
br label %13
13: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"/dev/hapara_trace\00"
@O_RDWR = global i32 0
define void @trace_clr() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = tail call i32 @_IO(i8 signext 116, i32 0)
%6 = tail call i32 @ioctl(i32 %2, i32 %5)
%7 = tail call i32 @close(i32 %2)
br label %8
8: ; preds = %0, %4
ret void
}
/* Variables and functions */
int core8_safe(char const *);
int U_EMREXTTEXTOUTW_safe(const char *record) { return (core8_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMREXTTEXTOUTW_safe>:
jmp    1030 <core8_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMREXTTEXTOUTW_safe(i8* %0) {
%2 = tail call i32 @core8_safe(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ getToken(int, int);
void advance(int fd, int sepBySpace) { getToken(fd, sepBySpace); }


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

x86 assembly (clang, -O2):
<advance>:
jmp    1030 <getToken@plt>

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

LLVM IR (-O2):
define void @advance(i32 %0, i32 %1) {
%3 = tail call i32 @getToken(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_FLASH_SELECT_PIN() { return 0x01 & (inp_emulate(0x38) >> 0); }


x86 assembly (clang, -O0):
<TOSH_READ_FLASH_SELECT_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x38,%edi
call   1030 <inp_emulate@plt>
sar    $0x0,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_FLASH_SELECT_PIN>:
push   %rax
mov    $0x38,%edi
call   1030 <inp_emulate@plt>
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_FLASH_SELECT_PIN() {
%1 = call i32 @inp_emulate(i32 56)
%2 = ashr i32 %1, 0
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_FLASH_SELECT_PIN() {
%1 = tail call i32 @inp_emulate(i32 56)
%2 = trunc i32 %1 to i8
%3 = and i8 %2, 1
ret i8 %3
}
/* Variables and functions */
scalar_t__ isalpha(int);
int is_xml_element_name_start_char(int c) {
  return isalpha(c) || c == ':' || c == '_';
}


x86 assembly (clang, -O0):
<is_xml_element_name_start_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    114e <is_xml_element_name_start_char+0x3e>
mov    $0x1,%al
cmpl   $0x3a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114e <is_xml_element_name_start_char+0x3e>
cmpl   $0x5f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_xml_element_name_start_char>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalpha@plt>
test   %rax,%rax
setne  %al
cmp    $0x3a,%ebx
sete   %cl
cmp    $0x5f,%ebx
sete   %dl
or     %cl,%dl
or     %al,%dl
movzbl %dl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_xml_element_name_start_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isalpha(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 58
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 95
br label %12
12: ; preds = %9, %6, %1
%13 = phi i1 [ true, %6 ], [ true, %1 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @is_xml_element_name_start_char(i32 %0) {
%2 = tail call i64 @isalpha(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i32 %0, 58
%5 = or i1 %4, %3
%6 = icmp eq i32 %0, 95
%7 = or i1 %6, %5
%8 = zext i1 %7 to i32
ret i32 %8
}
void U010ToABGR() {}


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

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

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

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