#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 /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ addIndex(unsigned int, unsigned int, unsigned int,
                            unsigned int, unsigned int, unsigned int);
int lseek(int, unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int read(int, unsigned char **, int);
int readDescription(int, unsigned int, unsigned int);
int sectionToSlave(int, int, unsigned int *);
int loadElf(int cpuf, int fd, unsigned int *entry_p, unsigned int *stack_p,
            int verbose) {
  unsigned char buf[4096];
  int ReadBytes = 0, err = 0;
  err = lseek(fd, 0x18, SEEK_SET);
  if (err < 0) {
    printf("error lseek(0x18) loadElf\n");
    return 1;
  }
  err = read(fd, &buf, 4);
  if (err != 4) {
    printf("error read(4) loadElf\n");
    return 1;
  }
  *entry_p = buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
  err = lseek(fd, 0x20, SEEK_SET);
  if (err < 0) {
    printf("error lseek(0x18) loadElf\n");
    return 1;
  }
  err = read(fd, &buf, 4);
  if (err != 4) {
    printf("error read(4) loadElf\n");
    return 1;
  }
  unsigned int TableAddress =
      buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
  err = lseek(fd, TableAddress, SEEK_SET);
  if (err < 0) {
    printf("error lseek(TableAdress) loadElf\n");
    return 1;
  }
  while ((ReadBytes = read(fd, &buf, 10 * sizeof(int))) == (10 * sizeof(int))) {
    unsigned int IncreasingNumber =
        buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
    unsigned int Flags = buf[4] | buf[5] << 8 | buf[6] << 16 | buf[7] << 24;
    unsigned int DontKnow2 =
        buf[8] | buf[9] << 8 | buf[10] << 16 | buf[11] << 24;
    unsigned int DestinationAddress =
        buf[12] | buf[13] << 8 | buf[14] << 16 | buf[15] << 24;
    unsigned int SourceAddress =
        buf[16] | buf[17] << 8 | buf[18] << 16 | buf[19] << 24;
    unsigned int Size = buf[20] | buf[21] << 8 | buf[22] << 16 | buf[23] << 24;
    unsigned int DontKnow3 =
        buf[24] | buf[25] << 8 | buf[26] << 16 | buf[27] << 24;
    unsigned int DontKnow4 =
        buf[28] | buf[29] << 8 | buf[30] << 16 | buf[31] << 24;
    unsigned int Alignment =
        buf[32] | buf[33] << 8 | buf[34] << 16 | buf[35] << 24;
    unsigned int DontKnow5 =
        buf[36] | buf[37] << 8 | buf[38] << 16 | buf[39] << 24;
    if (DestinationAddress == 0x00 && SourceAddress != 0x00) {
      err = readDescription(fd, SourceAddress, Size);
      if (err != 0)
        return 1;
      break;
    } else {
      addIndex(DestinationAddress, SourceAddress, Size, Alignment, Flags,
               DontKnow2);
    }
  }
  if (ReadBytes != 10 * sizeof(int)) {
    printf("error ReadBytes\n");
    return 1;
  }
  err = sectionToSlave(cpuf, fd, entry_p);
  if (err != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<loadElf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1070,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x1034(%rbp)
movl   $0x0,-0x1038(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2e45(%rip),%rax
mov    (%rax),%edx
mov    $0x18,%esi
call   1050 <lseek@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x0,-0x1038(%rbp)
jge    11d2 <loadElf+0x72>
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
mov    -0xc(%rbp),%edi
lea    -0x1030(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x4,-0x1038(%rbp)
je     1211 <loadElf+0xb1>
lea    0xe1b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
movzbl -0x1030(%rbp),%ecx
movzbl -0x102f(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
movzbl -0x102e(%rbp),%eax
shl    $0x10,%eax
or     %eax,%ecx
movzbl -0x102d(%rbp),%eax
shl    $0x18,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edi
mov    0x2d94(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1050 <lseek@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x0,-0x1038(%rbp)
jge    1283 <loadElf+0x123>
lea    0xd8e(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
mov    -0xc(%rbp),%edi
lea    -0x1030(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x4,-0x1038(%rbp)
je     12c2 <loadElf+0x162>
lea    0xd6a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
movzbl -0x1030(%rbp),%eax
movzbl -0x102f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x102e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x102d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x103c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x103c(%rbp),%esi
mov    0x2cdd(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x0,-0x1038(%rbp)
jge    1335 <loadElf+0x1d5>
lea    0xd0e(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
jmp    133a <loadElf+0x1da>
mov    -0xc(%rbp),%edi
lea    -0x1030(%rbp),%rsi
mov    $0x28,%edx
call   1060 <read@plt>
mov    %eax,-0x1034(%rbp)
cltq
cmp    $0x28,%rax
jne    15cc <loadElf+0x46c>
movzbl -0x1030(%rbp),%eax
movzbl -0x102f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x102e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x102d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1040(%rbp)
movzbl -0x102c(%rbp),%eax
movzbl -0x102b(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x102a(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1029(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1044(%rbp)
movzbl -0x1028(%rbp),%eax
movzbl -0x1027(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x1026(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1025(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1048(%rbp)
movzbl -0x1024(%rbp),%eax
movzbl -0x1023(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x1022(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1021(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x104c(%rbp)
movzbl -0x1020(%rbp),%eax
movzbl -0x101f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x101e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x101d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1050(%rbp)
movzbl -0x101c(%rbp),%eax
movzbl -0x101b(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x101a(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1019(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1054(%rbp)
movzbl -0x1018(%rbp),%eax
movzbl -0x1017(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x1016(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1015(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1058(%rbp)
movzbl -0x1014(%rbp),%eax
movzbl -0x1013(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x1012(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1011(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x105c(%rbp)
movzbl -0x1010(%rbp),%eax
movzbl -0x100f(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x100e(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x100d(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1060(%rbp)
movzbl -0x100c(%rbp),%eax
movzbl -0x100b(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x100a(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x1009(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x1064(%rbp)
cmpl   $0x0,-0x104c(%rbp)
jne    159c <loadElf+0x43c>
cmpl   $0x0,-0x1050(%rbp)
je     159c <loadElf+0x43c>
mov    -0xc(%rbp),%edi
mov    -0x1050(%rbp),%esi
mov    -0x1054(%rbp),%edx
call   1080 <readDescription@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x0,-0x1038(%rbp)
je     1597 <loadElf+0x437>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
jmp    15cc <loadElf+0x46c>
mov    -0x104c(%rbp),%edi
mov    -0x1050(%rbp),%esi
mov    -0x1054(%rbp),%edx
mov    -0x1060(%rbp),%ecx
mov    -0x1044(%rbp),%r8d
mov    -0x1048(%rbp),%r9d
call   1030 <addIndex@plt>
jmp    133a <loadElf+0x1da>
movslq -0x1034(%rbp),%rax
cmp    $0x28,%rax
je     15f5 <loadElf+0x495>
lea    0xa70(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1070 <sectionToSlave@plt>
mov    %eax,-0x1038(%rbp)
cmpl   $0x0,-0x1038(%rbp)
je     1623 <loadElf+0x4c3>
movl   $0x1,-0x4(%rbp)
jmp    162a <loadElf+0x4ca>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadElf>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1000,%rsp
mov    %rdx,%r12
mov    %esi,%ebp
mov    %edi,%r14d
mov    0x2e62(%rip),%rbx
mov    (%rbx),%edx
mov    %esi,%edi
mov    $0x18,%esi
call   1050 <lseek@plt>
test   %eax,%eax
js     120a <loadElf+0xaa>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
jne    1285 <loadElf+0x125>
mov    (%rsp),%eax
mov    %eax,(%r12)
mov    (%rbx),%edx
mov    %ebp,%edi
mov    $0x20,%esi
call   1050 <lseek@plt>
test   %eax,%eax
js     120a <loadElf+0xaa>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
jne    1285 <loadElf+0x125>
mov    (%rsp),%esi
mov    (%rbx),%edx
mov    %ebp,%edi
call   1050 <lseek@plt>
test   %eax,%eax
js     12af <loadElf+0x14f>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x28,%edx
call   1060 <read@plt>
cmp    $0x28,%eax
jne    12a6 <loadElf+0x146>
mov    %rsp,%r15
jmp    1247 <loadElf+0xe7>
lea    0xe36(%rip),%rdi
jmp    128c <loadElf+0x12c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x20(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    0x8(%rsp),%r9d
call   1040 <addIndex@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x28,%edx
call   1060 <read@plt>
cmp    $0x28,%eax
jne    12a6 <loadElf+0x146>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%edx
test   %edi,%edi
jne    1220 <loadElf+0xc0>
test   %esi,%esi
je     1220 <loadElf+0xc0>
mov    %ebp,%edi
call   1080 <readDescription@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
jne    1296 <loadElf+0x136>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r12,%rdx
call   1070 <sectionToSlave@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    1296 <loadElf+0x136>
lea    0xda5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x1000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd53(%rip),%rdi
jmp    128c <loadElf+0x12c>
lea    0xd5a(%rip),%rdi
jmp    128c <loadElf+0x12c>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [27 x i8] c"error lseek(0x18) loadElf\0A\00"
@.str.1 = [23 x i8] c"error read(4) loadElf\0A\00"
@.str.2 = [34 x i8] c"error lseek(TableAdress) loadElf\0A\00"
@.str.3 = [17 x i8] c"error ReadBytes\0A\00"
define i32 @loadElf(i32 %0, i32 %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca [4096 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 0, i32* %13
store i32 0, i32* %14
%26 = load i32, i32* %8
%27 = load i32, i32* @SEEK_SET
%28 = call i32 @lseek(i32 %26, i32 24, i32 %27)
store i32 %28, i32* %14
%29 = load i32, i32* %14
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %5
%32 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %329
33: ; preds = %5
%34 = load i32, i32* %8
%35 = bitcast [4096 x i8]* %12 to i8**
%36 = call i32 @read(i32 %34, i8** %35, i32 4)
store i32 %36, i32* %14
%37 = load i32, i32* %14
%38 = icmp ne i32 %37, 4
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %6
br label %329
41: ; preds = %33
%42 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 1
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = shl i32 %47, 8
%49 = or i32 %44, %48
%50 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 2
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = shl i32 %52, 16
%54 = or i32 %49, %53
%55 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 3
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = shl i32 %57, 24
%59 = or i32 %54, %58
%60 = load i32*, i32** %9
store i32 %59, i32* %60
%61 = load i32, i32* %8
%62 = load i32, i32* @SEEK_SET
%63 = call i32 @lseek(i32 %61, i32 32, i32 %62)
store i32 %63, i32* %14
%64 = load i32, i32* %14
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %41
%67 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %329
68: ; preds = %41
%69 = load i32, i32* %8
%70 = bitcast [4096 x i8]* %12 to i8**
%71 = call i32 @read(i32 %69, i8** %70, i32 4)
store i32 %71, i32* %14
%72 = load i32, i32* %14
%73 = icmp ne i32 %72, 4
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %6
br label %329
76: ; preds = %68
%77 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%78 = load i8, i8* %77
%79 = zext i8 %78 to i32
%80 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 1
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = shl i32 %82, 8
%84 = or i32 %79, %83
%85 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 2
%86 = load i8, i8* %85
%87 = zext i8 %86 to i32
%88 = shl i32 %87, 16
%89 = or i32 %84, %88
%90 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 3
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = shl i32 %92, 24
%94 = or i32 %89, %93
store i32 %94, i32* %15
%95 = load i32, i32* %8
%96 = load i32, i32* %15
%97 = load i32, i32* @SEEK_SET
%98 = call i32 @lseek(i32 %95, i32 %96, i32 %97)
store i32 %98, i32* %14
%99 = load i32, i32* %14
%100 = icmp slt i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %76
%102 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %6
br label %329
103: ; preds = %76
br label %104
104: ; preds = %313, %103
%105 = load i32, i32* %8
%106 = bitcast [4096 x i8]* %12 to i8**
%107 = call i32 @read(i32 %105, i8** %106, i32 40)
store i32 %107, i32* %13
%108 = sext i32 %107 to i64
%109 = icmp eq i64 %108, 40
br i1 %109, label %110, label %314
110: ; preds = %104
%111 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 1
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = shl i32 %116, 8
%118 = or i32 %113, %117
%119 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 2
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = shl i32 %121, 16
%123 = or i32 %118, %122
%124 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 3
%125 = load i8, i8* %124
%126 = zext i8 %125 to i32
%127 = shl i32 %126, 24
%128 = or i32 %123, %127
store i32 %128, i32* %16
%129 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 4
%130 = load i8, i8* %129
%131 = zext i8 %130 to i32
%132 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 5
%133 = load i8, i8* %132
%134 = zext i8 %133 to i32
%135 = shl i32 %134, 8
%136 = or i32 %131, %135
%137 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 6
%138 = load i8, i8* %137
%139 = zext i8 %138 to i32
%140 = shl i32 %139, 16
%141 = or i32 %136, %140
%142 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 7
%143 = load i8, i8* %142
%144 = zext i8 %143 to i32
%145 = shl i32 %144, 24
%146 = or i32 %141, %145
store i32 %146, i32* %17
%147 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 8
%148 = load i8, i8* %147
%149 = zext i8 %148 to i32
%150 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 9
%151 = load i8, i8* %150
%152 = zext i8 %151 to i32
%153 = shl i32 %152, 8
%154 = or i32 %149, %153
%155 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 10
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = shl i32 %157, 16
%159 = or i32 %154, %158
%160 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 11
%161 = load i8, i8* %160
%162 = zext i8 %161 to i32
%163 = shl i32 %162, 24
%164 = or i32 %159, %163
store i32 %164, i32* %18
%165 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 12
%166 = load i8, i8* %165
%167 = zext i8 %166 to i32
%168 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 13
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = shl i32 %170, 8
%172 = or i32 %167, %171
%173 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 14
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
%176 = shl i32 %175, 16
%177 = or i32 %172, %176
%178 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 15
%179 = load i8, i8* %178
%180 = zext i8 %179 to i32
%181 = shl i32 %180, 24
%182 = or i32 %177, %181
store i32 %182, i32* %19
%183 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 16
%184 = load i8, i8* %183
%185 = zext i8 %184 to i32
%186 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 17
%187 = load i8, i8* %186
%188 = zext i8 %187 to i32
%189 = shl i32 %188, 8
%190 = or i32 %185, %189
%191 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 18
%192 = load i8, i8* %191
%193 = zext i8 %192 to i32
%194 = shl i32 %193, 16
%195 = or i32 %190, %194
%196 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 19
%197 = load i8, i8* %196
%198 = zext i8 %197 to i32
%199 = shl i32 %198, 24
%200 = or i32 %195, %199
store i32 %200, i32* %20
%201 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 20
%202 = load i8, i8* %201
%203 = zext i8 %202 to i32
%204 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 21
%205 = load i8, i8* %204
%206 = zext i8 %205 to i32
%207 = shl i32 %206, 8
%208 = or i32 %203, %207
%209 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 22
%210 = load i8, i8* %209
%211 = zext i8 %210 to i32
%212 = shl i32 %211, 16
%213 = or i32 %208, %212
%214 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 23
%215 = load i8, i8* %214
%216 = zext i8 %215 to i32
%217 = shl i32 %216, 24
%218 = or i32 %213, %217
store i32 %218, i32* %21
%219 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 24
%220 = load i8, i8* %219
%221 = zext i8 %220 to i32
%222 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 25
%223 = load i8, i8* %222
%224 = zext i8 %223 to i32
%225 = shl i32 %224, 8
%226 = or i32 %221, %225
%227 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 26
%228 = load i8, i8* %227
%229 = zext i8 %228 to i32
%230 = shl i32 %229, 16
%231 = or i32 %226, %230
%232 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 27
%233 = load i8, i8* %232
%234 = zext i8 %233 to i32
%235 = shl i32 %234, 24
%236 = or i32 %231, %235
store i32 %236, i32* %22
%237 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 28
%238 = load i8, i8* %237
%239 = zext i8 %238 to i32
%240 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 29
%241 = load i8, i8* %240
%242 = zext i8 %241 to i32
%243 = shl i32 %242, 8
%244 = or i32 %239, %243
%245 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 30
%246 = load i8, i8* %245
%247 = zext i8 %246 to i32
%248 = shl i32 %247, 16
%249 = or i32 %244, %248
%250 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 31
%251 = load i8, i8* %250
%252 = zext i8 %251 to i32
%253 = shl i32 %252, 24
%254 = or i32 %249, %253
store i32 %254, i32* %23
%255 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 32
%256 = load i8, i8* %255
%257 = zext i8 %256 to i32
%258 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 33
%259 = load i8, i8* %258
%260 = zext i8 %259 to i32
%261 = shl i32 %260, 8
%262 = or i32 %257, %261
%263 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 34
%264 = load i8, i8* %263
%265 = zext i8 %264 to i32
%266 = shl i32 %265, 16
%267 = or i32 %262, %266
%268 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 35
%269 = load i8, i8* %268
%270 = zext i8 %269 to i32
%271 = shl i32 %270, 24
%272 = or i32 %267, %271
store i32 %272, i32* %24
%273 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 36
%274 = load i8, i8* %273
%275 = zext i8 %274 to i32
%276 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 37
%277 = load i8, i8* %276
%278 = zext i8 %277 to i32
%279 = shl i32 %278, 8
%280 = or i32 %275, %279
%281 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 38
%282 = load i8, i8* %281
%283 = zext i8 %282 to i32
%284 = shl i32 %283, 16
%285 = or i32 %280, %284
%286 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 39
%287 = load i8, i8* %286
%288 = zext i8 %287 to i32
%289 = shl i32 %288, 24
%290 = or i32 %285, %289
store i32 %290, i32* %25
%291 = load i32, i32* %19
%292 = icmp eq i32 %291, 0
br i1 %292, label %293, label %305
293: ; preds = %110
%294 = load i32, i32* %20
%295 = icmp ne i32 %294, 0
br i1 %295, label %296, label %305
296: ; preds = %293
%297 = load i32, i32* %8
%298 = load i32, i32* %20
%299 = load i32, i32* %21
%300 = call i32 @readDescription(i32 %297, i32 %298, i32 %299)
store i32 %300, i32* %14
%301 = load i32, i32* %14
%302 = icmp ne i32 %301, 0
br i1 %302, label %303, label %304
303: ; preds = %296
store i32 1, i32* %6
br label %329
304: ; preds = %296
br label %314
305: ; preds = %293, %110
%306 = load i32, i32* %19
%307 = load i32, i32* %20
%308 = load i32, i32* %21
%309 = load i32, i32* %24
%310 = load i32, i32* %17
%311 = load i32, i32* %18
%312 = call i32 @addIndex(i32 %306, i32 %307, i32 %308, i32 %309, i32 %310, i32 %311)
br label %313
313: ; preds = %305
br label %104
314: ; preds = %304, %104
%315 = load i32, i32* %13
%316 = sext i32 %315 to i64
%317 = icmp ne i64 %316, 40
br i1 %317, label %318, label %320
318: ; preds = %314
%319 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %6
br label %329
320: ; preds = %314
%321 = load i32, i32* %7
%322 = load i32, i32* %8
%323 = load i32*, i32** %9
%324 = call i32 @sectionToSlave(i32 %321, i32 %322, i32* %323)
store i32 %324, i32* %14
%325 = load i32, i32* %14
%326 = icmp ne i32 %325, 0
br i1 %326, label %327, label %328
327: ; preds = %320
store i32 1, i32* %6
br label %329
328: ; preds = %320
store i32 0, i32* %6
br label %329
329: ; preds = %328, %327, %318, %303, %101, %74, %66, %39, %31
%330 = load i32, i32* %6
ret i32 %330
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@str = [16 x i8] c"error ReadBytes\00"
@str.4 = [33 x i8] c"error lseek(TableAdress) loadElf\00"
@str.7 = [22 x i8] c"error read(4) loadElf\00"
@str.8 = [26 x i8] c"error lseek(0x18) loadElf\00"
define i32 @loadElf(i32 %0, i32 %1, i32* %2, i32* nocapture readnone %3, i32 %4) {
%6 = alloca [4096 x i8]
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @lseek(i32 %1, i32 24, i32 %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
br label %196
13: ; preds = %5
%14 = bitcast [4096 x i8]* %6 to i8**
%15 = call i32 @read(i32 %1, i8** %14, i32 4)
%16 = icmp eq i32 %15, 4
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
br label %196
19: ; preds = %13
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 1
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = shl nuw nsw i32 %24, 8
%26 = or i32 %25, %21
%27 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 2
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = shl nuw nsw i32 %29, 16
%31 = or i32 %26, %30
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 3
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = shl nuw i32 %34, 24
%36 = or i32 %31, %35
store i32 %36, i32* %2
%37 = load i32, i32* @SEEK_SET
%38 = tail call i32 @lseek(i32 %1, i32 32, i32 %37)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %19
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
br label %196
42: ; preds = %19
%43 = call i32 @read(i32 %1, i8** %14, i32 4)
%44 = icmp eq i32 %43, 4
br i1 %44, label %47, label %45
45: ; preds = %42
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
br label %196
47: ; preds = %42
%48 = load i8, i8* %7
%49 = zext i8 %48 to i32
%50 = load i8, i8* %22
%51 = zext i8 %50 to i32
%52 = shl nuw nsw i32 %51, 8
%53 = or i32 %52, %49
%54 = load i8, i8* %27
%55 = zext i8 %54 to i32
%56 = shl nuw nsw i32 %55, 16
%57 = or i32 %53, %56
%58 = load i8, i8* %32
%59 = zext i8 %58 to i32
%60 = shl nuw i32 %59, 24
%61 = or i32 %57, %60
%62 = load i32, i32* @SEEK_SET
%63 = tail call i32 @lseek(i32 %1, i32 %61, i32 %62)
%64 = icmp slt i32 %63, 0
br i1 %64, label %93, label %65
65: ; preds = %47
%66 = call i32 @read(i32 %1, i8** %14, i32 40)
%67 = icmp eq i32 %66, 40
br i1 %67, label %68, label %190
68: ; preds = %65
%69 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 12
%70 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 13
%71 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 14
%72 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 15
%73 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 16
%74 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 17
%75 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 18
%76 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 19
%77 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 20
%78 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 21
%79 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 22
%80 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 23
%81 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 33
%82 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 32
%83 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 34
%84 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 35
%85 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 9
%86 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 8
%87 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 10
%88 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 11
%89 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 5
%90 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 4
%91 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 6
%92 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 7
br label %95
93: ; preds = %47
%94 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0))
br label %196
95: ; preds = %68, %144
%96 = load i8, i8* %69
%97 = zext i8 %96 to i32
%98 = load i8, i8* %70
%99 = zext i8 %98 to i32
%100 = shl nuw nsw i32 %99, 8
%101 = or i32 %100, %97
%102 = load i8, i8* %71
%103 = zext i8 %102 to i32
%104 = shl nuw nsw i32 %103, 16
%105 = or i32 %101, %104
%106 = load i8, i8* %72
%107 = zext i8 %106 to i32
%108 = shl nuw i32 %107, 24
%109 = or i32 %105, %108
%110 = load i8, i8* %73
%111 = zext i8 %110 to i32
%112 = load i8, i8* %74
%113 = zext i8 %112 to i32
%114 = shl nuw nsw i32 %113, 8
%115 = or i32 %114, %111
%116 = load i8, i8* %75
%117 = zext i8 %116 to i32
%118 = shl nuw nsw i32 %117, 16
%119 = or i32 %115, %118
%120 = load i8, i8* %76
%121 = zext i8 %120 to i32
%122 = shl nuw i32 %121, 24
%123 = or i32 %119, %122
%124 = load i8, i8* %77
%125 = zext i8 %124 to i32
%126 = load i8, i8* %78
%127 = zext i8 %126 to i32
%128 = shl nuw nsw i32 %127, 8
%129 = or i32 %128, %125
%130 = load i8, i8* %79
%131 = zext i8 %130 to i32
%132 = shl nuw nsw i32 %131, 16
%133 = or i32 %129, %132
%134 = load i8, i8* %80
%135 = zext i8 %134 to i32
%136 = shl nuw i32 %135, 24
%137 = or i32 %133, %136
%138 = icmp eq i32 %109, 0
%139 = icmp ne i32 %123, 0
%140 = select i1 %138, i1 %139, i1 false
br i1 %140, label %141, label %144
141: ; preds = %95
%142 = tail call i32 @readDescription(i32 %1, i32 %123, i32 %137)
%143 = icmp eq i32 %142, 0
br i1 %143, label %192, label %196
144: ; preds = %95
%145 = load i8, i8* %81
%146 = zext i8 %145 to i32
%147 = shl nuw nsw i32 %146, 8
%148 = load i8, i8* %82
%149 = zext i8 %148 to i32
%150 = or i32 %147, %149
%151 = load i8, i8* %83
%152 = zext i8 %151 to i32
%153 = shl nuw nsw i32 %152, 16
%154 = or i32 %150, %153
%155 = load i8, i8* %84
%156 = zext i8 %155 to i32
%157 = shl nuw i32 %156, 24
%158 = or i32 %154, %157
%159 = load i8, i8* %85
%160 = zext i8 %159 to i32
%161 = shl nuw nsw i32 %160, 8
%162 = load i8, i8* %86
%163 = zext i8 %162 to i32
%164 = or i32 %161, %163
%165 = load i8, i8* %87
%166 = zext i8 %165 to i32
%167 = shl nuw nsw i32 %166, 16
%168 = or i32 %164, %167
%169 = load i8, i8* %88
%170 = zext i8 %169 to i32
%171 = shl nuw i32 %170, 24
%172 = or i32 %168, %171
%173 = load i8, i8* %89
%174 = zext i8 %173 to i32
%175 = shl nuw nsw i32 %174, 8
%176 = load i8, i8* %90
%177 = zext i8 %176 to i32
%178 = or i32 %175, %177
%179 = load i8, i8* %91
%180 = zext i8 %179 to i32
%181 = shl nuw nsw i32 %180, 16
%182 = or i32 %178, %181
%183 = load i8, i8* %92
%184 = zext i8 %183 to i32
%185 = shl nuw i32 %184, 24
%186 = or i32 %182, %185
%187 = tail call i32 @addIndex(i32 %109, i32 %123, i32 %137, i32 %158, i32 %186, i32 %172)
%188 = call i32 @read(i32 %1, i8** %14, i32 40)
%189 = icmp eq i32 %188, 40
br i1 %189, label %95, label %190
190: ; preds = %144, %65
%191 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %196
192: ; preds = %141
%193 = tail call i32 @sectionToSlave(i32 %0, i32 %1, i32* %2)
%194 = icmp ne i32 %193, 0
%195 = zext i1 %194 to i32
br label %196
196: ; preds = %141, %93, %190, %192, %45, %40, %17, %11
%197 = phi i32 [ 1, %11 ], [ 1, %17 ], [ 1, %40 ], [ 1, %45 ], [ 1, %93 ], [ 1, %190 ], [ %195, %192 ], [ 1, %141 ]
ret i32 %197
}