#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int loaderGetInt(char *);
int vmemAllocString(char *, int);
int /*<<< orphan*/ vmemPush(int);
int /*<<< orphan*/ vmemStacktotab(int);
char *loaderInitRec(char *src) {
  int l, i;
  l = loaderGetInt(src);
  src += 4;
  if (l == -1) {
    vmemPush((-1));
  } else if (l & 1) {
    l >>= 1;
    if (l & 1) {
      l >>= 1;
      for (i = 0; i < l; i++)
        src = loaderInitRec(src);
      vmemStacktotab(l);
    } else {
      l >>= 1;
      vmemPush((1 + ((vmemAllocString(src, l)) << 1)));
      src += l;
    }
  } else {
    vmemPush(l);
  }
  return src;
}


x86 assembly (clang, -O0):
<loaderInitRec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <loaderGetInt@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    118d <loaderInitRec+0x3d>
mov    $0xffffffff,%edi
call   1070 <vmemPush@plt>
jmp    123d <loaderInitRec+0xed>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1230 <loaderInitRec+0xe0>
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f8 <loaderInitRec+0xa8>
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11eb <loaderInitRec+0x9b>
mov    -0x8(%rbp),%rdi
call   1030 <loaderInitRec@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c4 <loaderInitRec+0x74>
mov    -0xc(%rbp),%edi
call   1040 <vmemStacktotab@plt>
jmp    122b <loaderInitRec+0xdb>
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <vmemAllocString@plt>
mov    %eax,%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1070 <vmemPush@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1238 <loaderInitRec+0xe8>
mov    -0xc(%rbp),%edi
call   1070 <vmemPush@plt>
jmp    123d <loaderInitRec+0xed>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loaderInitRec>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1050 <loaderGetInt@plt>
add    $0x4,%rbx
cmp    $0xffffffff,%eax
je     116d <loaderInitRec+0x1d>
test   $0x1,%al
jne    117f <loaderInitRec+0x2f>
mov    %eax,%edi
jmp    1172 <loaderInitRec+0x22>
mov    $0xffffffff,%edi
call   1070 <vmemPush@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%r14d
sar    $0x2,%r14d
test   $0x2,%al
jne    11a8 <loaderInitRec+0x58>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1060 <vmemAllocString@plt>
lea    (%rax,%rax,1),%edi
add    $0x1,%edi
call   1070 <vmemPush@plt>
movslq %r14d,%rax
add    %rax,%rbx
jmp    1177 <loaderInitRec+0x27>
cmp    $0x4,%eax
jl     11d0 <loaderInitRec+0x80>
cmp    $0x2,%r14d
mov    $0x1,%ebp
cmovge %r14d,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <loaderInitRec@plt>
mov    %rax,%rbx
add    $0xffffffff,%ebp
jne    11c0 <loaderInitRec+0x70>
mov    %r14d,%edi
call   1040 <vmemStacktotab@plt>
jmp    1177 <loaderInitRec+0x27>

LLVM IR (-O0):
define i8* @loaderInitRec(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @loaderGetInt(i8* %5)
store i32 %6, i32* %3
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 4
store i8* %8, i8** %2
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @vmemPush(i32 -1)
br label %57
13: ; preds = %1
%14 = load i32, i32* %3
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %53
17: ; preds = %13
%18 = load i32, i32* %3
%19 = ashr i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = and i32 %20, 1
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %39
23: ; preds = %17
%24 = load i32, i32* %3
%25 = ashr i32 %24, 1
store i32 %25, i32* %3
store i32 0, i32* %4
br label %26
26: ; preds = %33, %23
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i8*, i8** %2
%32 = call i8* @loaderInitRec(i8* %31)
store i8* %32, i8** %2
br label %33
33: ; preds = %30
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %26
36: ; preds = %26
%37 = load i32, i32* %3
%38 = call i32 @vmemStacktotab(i32 %37)
br label %52
39: ; preds = %17
%40 = load i32, i32* %3
%41 = ashr i32 %40, 1
store i32 %41, i32* %3
%42 = load i8*, i8** %2
%43 = load i32, i32* %3
%44 = call i32 @vmemAllocString(i8* %42, i32 %43)
%45 = shl i32 %44, 1
%46 = add nsw i32 1, %45
%47 = call i32 @vmemPush(i32 %46)
%48 = load i32, i32* %3
%49 = load i8*, i8** %2
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds i8, i8* %49, i64 %50
store i8* %51, i8** %2
br label %52
52: ; preds = %39, %36
br label %56
53: ; preds = %13
%54 = load i32, i32* %3
%55 = call i32 @vmemPush(i32 %54)
br label %56
56: ; preds = %53, %52
br label %57
57: ; preds = %56, %11
%58 = load i8*, i8** %2
ret i8* %58
}

LLVM IR (-O2):
define i8* @loaderInitRec(i8* %0) {
%2 = tail call i32 @loaderGetInt(i8* %0)
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = icmp eq i32 %2, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @vmemPush(i32 -1)
br label %36
7: ; preds = %1
%8 = and i32 %2, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %34, label %10
10: ; preds = %7
%11 = and i32 %2, 2
%12 = icmp eq i32 %11, 0
%13 = ashr i32 %2, 2
br i1 %12, label %27, label %14
14: ; preds = %10
%15 = icmp sgt i32 %2, 3
br i1 %15, label %16, label %24
16: ; preds = %14
%17 = call i32 @llvm.smax.i32(i32 %13, i32 1)
br label %18
18: ; preds = %16, %18
%19 = phi i32 [ %22, %18 ], [ 0, %16 ]
%20 = phi i8* [ %21, %18 ], [ %3, %16 ]
%21 = tail call i8* @loaderInitRec(i8* %20)
%22 = add nuw nsw i32 %19, 1
%23 = icmp eq i32 %22, %17
br i1 %23, label %24, label %18
24: ; preds = %18, %14
%25 = phi i8* [ %3, %14 ], [ %21, %18 ]
%26 = tail call i32 @vmemStacktotab(i32 %13)
br label %36
27: ; preds = %10
%28 = tail call i32 @vmemAllocString(i8* %3, i32 %13)
%29 = shl i32 %28, 1
%30 = or i32 %29, 1
%31 = tail call i32 @vmemPush(i32 %30)
%32 = sext i32 %13 to i64
%33 = getelementptr inbounds i8, i8* %3, i64 %32
br label %36
34: ; preds = %7
%35 = tail call i32 @vmemPush(i32 %2)
br label %36
36: ; preds = %34, %27, %24, %5
%37 = phi i8* [ %3, %5 ], [ %25, %24 ], [ %33, %27 ], [ %3, %34 ]
ret i8* %37
}