#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*/ MAP_SHARED;
int O_RDWR;
int O_SYNC;
int PROT_READ;
int PROT_WRITE;
int Xil_In32(unsigned int *, unsigned int);
int /*<<< orphan*/ Xil_Out32(unsigned int *, unsigned int, int);
int /*<<< orphan*/ close(int);
unsigned int *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
                   int);
int /*<<< orphan*/ munmap(unsigned int *, int);
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int do_pr(int pr_size, unsigned int pr_begin_addr, unsigned int vsm) {
  unsigned int vsm_off = vsm << 7;
  printf("PR DDR address:0x%X; pr_size: %d; vsm: %d\n", pr_begin_addr, pr_size,
         vsm);
  int devmemfd = open("/dev/mem", O_RDWR | O_SYNC);
  if (devmemfd < 1) {
    printf("apploadpr: devmem open failed.\n");
    return 0;
  }
  unsigned int *icap = mmap(NULL, 0xFFFF, PROT_READ | PROT_WRITE, MAP_SHARED,
                            devmemfd, 0x42000000);
  unsigned int Status;
  unsigned int loading_done = 0;
  Xil_Out32(icap, vsm_off | 0X00000, 0);
  while (!(Xil_In32(icap, vsm_off | 0X00000) & 0x80))
    ;
  Xil_Out32(icap, vsm_off | 0X00064, pr_begin_addr + vsm * pr_size);
  Xil_Out32(icap, vsm_off | 0X00068, pr_size);
  Xil_Out32(icap, vsm_off | 0X00020, 0);
  Xil_Out32(icap, vsm_off | 0X00040, 0);
  Xil_Out32(icap, vsm_off | 0X00044, 0x1FF0);
  printf("Adder RM address  = %x\n", Xil_In32(icap, vsm_off | 0X00064));
  printf("Adder RM size     = %d Bytes\n", Xil_In32(icap, vsm_off | 0X00068));
  Xil_Out32(icap, vsm_off | 0X00000, 2);
  Status = Xil_In32(icap, vsm_off | 0X00004);
  if (!(Status & 0x8000)) {
    Xil_Out32(icap, vsm_off | 0X00004, 0);
  }
  loading_done = 0;
  while (!loading_done) {
    Status = Xil_In32(icap, vsm_off | 0X00000) & 0x07;
    switch (Status) {
    case 7:
      printf("RM loaded\n");
      loading_done = 1;
      break;
    case 6:
      printf("RM is being reset\n");
      break;
    case 5:
      printf("Software start-up step\n");
      break;
    case 4:
      break;
    case 2:
      printf("Software shutdown\n");
      break;
    case 1:
      printf("Hardware shutdown\n");
      break;
    default:
      break;
    }
  }
  printf("VADD Reconfiguration Completed!\n\n");
pr_exit:
  munmap(icap, 0xFFFF);
  close(devmemfd);
  return 1;
}


x86 assembly (clang, -O0):
<do_pr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%esi
mov    0x2e1f(%rip),%rax
or     (%rax),%esi
lea    0xe8d(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jge    11e6 <do_pr+0x76>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1444 <do_pr+0x2d4>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edx
mov    0x2dca(%rip),%rax
or     (%rax),%edx
mov    0x2de9(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffff,%esi
mov    $0x42000000,%r9d
call   1050 <mmap@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x0,%esi
xor    %edx,%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x0,%esi
call   1030 <Xil_In32@plt>
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    125e <do_pr+0xee>
jmp    1263 <do_pr+0xf3>
jmp    1235 <do_pr+0xc5>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x64,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%eax
imul   -0x8(%rbp),%eax
add    %eax,%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x68,%esi
mov    -0x8(%rbp),%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x20,%esi
xor    %edx,%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x40,%esi
xor    %edx,%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x44,%esi
mov    $0x1ff0,%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x64,%esi
call   1030 <Xil_In32@plt>
mov    %eax,%esi
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x68,%esi
call   1030 <Xil_In32@plt>
mov    %eax,%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x0,%esi
mov    $0x2,%edx
call   1040 <Xil_Out32@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x4,%esi
call   1030 <Xil_In32@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
jne    134c <do_pr+0x1dc>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
or     $0x4,%esi
xor    %edx,%edx
call   1040 <Xil_Out32@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1369 <do_pr+0x1f9>
jmp    1419 <do_pr+0x2a9>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <Xil_In32@plt>
and    $0x7,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x6,%eax
ja     140f <do_pr+0x29f>
mov    -0x30(%rbp),%rax
lea    0xc65(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xcfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x28(%rbp)
jmp    1414 <do_pr+0x2a4>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1414 <do_pr+0x2a4>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1414 <do_pr+0x2a4>
jmp    1414 <do_pr+0x2a4>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1414 <do_pr+0x2a4>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1414 <do_pr+0x2a4>
jmp    1414 <do_pr+0x2a4>
jmp    1353 <do_pr+0x1e3>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    $0xffff,%esi
call   1080 <munmap@plt>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_pr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
mov    %esi,%ebp
mov    %edi,%r15d
lea    0xe82(%rip),%rdi
xor    %ebx,%ebx
mov    %r15d,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2e28(%rip),%rax
mov    0x2e19(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe85(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
jle    138e <do_pr+0x20e>
mov    %ebp,%ebx
mov    %r12d,%r14d
shl    $0x7,%r14d
mov    0x2e19(%rip),%rsi
mov    0x2dda(%rip),%rcx
mov    (%rcx),%edx
or     (%rsi),%edx
mov    0x2df7(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    $0xffff,%esi
mov    %eax,0x4(%rsp)
mov    %eax,%r8d
mov    $0x42000000,%r9d
call   1060 <mmap@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1050 <Xil_Out32@plt>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r14d,%esi
call   1030 <Xil_In32@plt>
test   $0x80,%al
je     1220 <do_pr+0xa0>
mov    %r14d,%ebp
or     $0x64,%ebp
imul   %r15d,%r12d
add    %ebx,%r12d
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
call   1050 <Xil_Out32@plt>
mov    %r14d,%r12d
or     $0x68,%r12d
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
call   1050 <Xil_Out32@plt>
mov    %r14d,%esi
or     $0x20,%esi
mov    %r13,%rdi
xor    %edx,%edx
call   1050 <Xil_Out32@plt>
mov    %r14d,%esi
or     $0x40,%esi
mov    %r13,%rdi
xor    %edx,%edx
call   1050 <Xil_Out32@plt>
mov    %r14d,%esi
or     $0x44,%esi
mov    %r13,%rdi
mov    $0x1ff0,%edx
call   1050 <Xil_Out32@plt>
mov    %r13,%rdi
mov    %ebp,%esi
call   1030 <Xil_In32@plt>
lea    0xdae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
mov    %r12d,%esi
call   1030 <Xil_In32@plt>
lea    0xdab(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
mov    %r14d,%esi
mov    $0x2,%edx
call   1050 <Xil_Out32@plt>
mov    %r14d,%ebp
or     $0x4,%ebp
mov    %r13,%rdi
mov    %ebp,%esi
call   1030 <Xil_In32@plt>
test   $0x8000,%eax
jne    12f9 <do_pr+0x179>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1050 <Xil_Out32@plt>
lea    0xde2(%rip),%rbp
lea    0xcf9(%rip),%rbx
lea    0xd99(%rip),%r12
lea    0xdb6(%rip),%r15
jmp    1323 <do_pr+0x1a3>
lea    0xd9b(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
mov    %r14d,%esi
call   1030 <Xil_In32@plt>
and    $0x7,%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     1323 <do_pr+0x1a3>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
mov    %rbp,%rdi
jmp    *%rax
mov    %r12,%rdi
call   1040 <puts@plt>
jmp    1323 <do_pr+0x1a3>
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    1323 <do_pr+0x1a3>
lea    0xd94(%rip),%rdi
call   1040 <puts@plt>
lea    0xd1a(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
mov    $0xffff,%esi
call   1090 <munmap@plt>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
mov    $0x1,%ebx
jmp    139a <do_pr+0x21a>
lea    0xd69(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"PR DDR address:0x%X; pr_size: %d; vsm: %d\0A\00"
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@O_SYNC = global i32 0
@.str.2 = [32 x i8] c"apploadpr: devmem open failed.\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.3 = [24 x i8] c"Adder RM address = %x\0A\00"
@.str.4 = [30 x i8] c"Adder RM size = %d Bytes\0A\00"
@.str.5 = [11 x i8] c"RM loaded\0A\00"
@.str.6 = [19 x i8] c"RM is being reset\0A\00"
@.str.7 = [24 x i8] c"Software start-up step\0A\00"
@.str.8 = [19 x i8] c"Software shutdown\0A\00"
@.str.9 = [19 x i8] c"Hardware shutdown\0A\00"
@.str.10 = [34 x i8] c"VADD Reconfiguration Completed!\0A\0A\00"
define i32 @do_pr(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%13 = load i32, i32* %7
%14 = shl i32 %13, 7
store i32 %14, i32* %8
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = load i32, i32* %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
%19 = load i32, i32* @O_RDWR
%20 = load i32, i32* @O_SYNC
%21 = or i32 %19, %20
%22 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %21)
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %132
27: ; preds = %3
%28 = load i32, i32* @PROT_READ
%29 = load i32, i32* @PROT_WRITE
%30 = or i32 %28, %29
%31 = load i32, i32* @MAP_SHARED
%32 = load i32, i32* %9
%33 = call i32* @mmap(i32* null, i32 65535, i32 %30, i32 %31, i32 %32, i32 1107296256)
store i32* %33, i32** %10
store i32 0, i32* %12
%34 = load i32*, i32** %10
%35 = load i32, i32* %8
%36 = or i32 %35, 0
%37 = call i32 @Xil_Out32(i32* %34, i32 %36, i32 0)
br label %38
38: ; preds = %46, %27
%39 = load i32*, i32** %10
%40 = load i32, i32* %8
%41 = or i32 %40, 0
%42 = call i32 @Xil_In32(i32* %39, i32 %41)
%43 = and i32 %42, 128
%44 = icmp ne i32 %43, 0
%45 = xor i1 %44, true
br i1 %45, label %46, label %47
46: ; preds = %38
br label %38
47: ; preds = %38
%48 = load i32*, i32** %10
%49 = load i32, i32* %8
%50 = or i32 %49, 100
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = load i32, i32* %5
%54 = mul i32 %52, %53
%55 = add i32 %51, %54
%56 = call i32 @Xil_Out32(i32* %48, i32 %50, i32 %55)
%57 = load i32*, i32** %10
%58 = load i32, i32* %8
%59 = or i32 %58, 104
%60 = load i32, i32* %5
%61 = call i32 @Xil_Out32(i32* %57, i32 %59, i32 %60)
%62 = load i32*, i32** %10
%63 = load i32, i32* %8
%64 = or i32 %63, 32
%65 = call i32 @Xil_Out32(i32* %62, i32 %64, i32 0)
%66 = load i32*, i32** %10
%67 = load i32, i32* %8
%68 = or i32 %67, 64
%69 = call i32 @Xil_Out32(i32* %66, i32 %68, i32 0)
%70 = load i32*, i32** %10
%71 = load i32, i32* %8
%72 = or i32 %71, 68
%73 = call i32 @Xil_Out32(i32* %70, i32 %72, i32 8176)
%74 = load i32*, i32** %10
%75 = load i32, i32* %8
%76 = or i32 %75, 100
%77 = call i32 @Xil_In32(i32* %74, i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %77)
%79 = load i32*, i32** %10
%80 = load i32, i32* %8
%81 = or i32 %80, 104
%82 = call i32 @Xil_In32(i32* %79, i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %82)
%84 = load i32*, i32** %10
%85 = load i32, i32* %8
%86 = or i32 %85, 0
%87 = call i32 @Xil_Out32(i32* %84, i32 %86, i32 2)
%88 = load i32*, i32** %10
%89 = load i32, i32* %8
%90 = or i32 %89, 4
%91 = call i32 @Xil_In32(i32* %88, i32 %90)
store i32 %91, i32* %11
%92 = load i32, i32* %11
%93 = and i32 %92, 32768
%94 = icmp ne i32 %93, 0
br i1 %94, label %100, label %95
95: ; preds = %47
%96 = load i32*, i32** %10
%97 = load i32, i32* %8
%98 = or i32 %97, 4
%99 = call i32 @Xil_Out32(i32* %96, i32 %98, i32 0)
br label %100
100: ; preds = %95, %47
store i32 0, i32* %12
br label %101
101: ; preds = %124, %100
%102 = load i32, i32* %12
%103 = icmp ne i32 %102, 0
%104 = xor i1 %103, true
br i1 %104, label %105, label %125
105: ; preds = %101
%106 = load i32*, i32** %10
%107 = load i32, i32* %8
%108 = or i32 %107, 0
%109 = call i32 @Xil_In32(i32* %106, i32 %108)
%110 = and i32 %109, 7
store i32 %110, i32* %11
%111 = load i32, i32* %11
switch i32 %111, label %123 [
i32 7, label %112
i32 6, label %114
i32 5, label %116
i32 4, label %118
i32 2, label %119
i32 1, label %121
]
112: ; preds = %105
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %12
br label %124
114: ; preds = %105
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
br label %124
116: ; preds = %105
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %124
118: ; preds = %105
br label %124
119: ; preds = %105
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %124
121: ; preds = %105
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %124
123: ; preds = %105
br label %124
124: ; preds = %123, %121, %119, %118, %116, %114, %112
br label %101
125: ; preds = %101
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
br label %127
127: ; preds = %125
%128 = load i32*, i32** %10
%129 = call i32 @munmap(i32* %128, i32 65535)
%130 = load i32, i32* %9
%131 = call i32 @close(i32 %130)
store i32 1, i32* %4
br label %132
132: ; preds = %127, %25
%133 = load i32, i32* %4
ret i32 %133
}

LLVM IR (-O2):
@.str = [43 x i8] c"PR DDR address:0x%X; pr_size: %d; vsm: %d\0A\00"
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@O_SYNC = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.3 = [24 x i8] c"Adder RM address = %x\0A\00"
@.str.4 = [30 x i8] c"Adder RM size = %d Bytes\0A\00"
@str = [33 x i8] c"VADD Reconfiguration Completed!\0A\00"
@str.11 = [18 x i8] c"Software shutdown\00"
@str.12 = [18 x i8] c"Hardware shutdown\00"
@str.13 = [23 x i8] c"Software start-up step\00"
@str.14 = [18 x i8] c"RM is being reset\00"
@str.15 = [10 x i8] c"RM loaded\00"
@str.16 = [31 x i8] c"apploadpr: devmem open failed.\00"
define i32 @do_pr(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 7
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0, i32 %2)
%6 = load i32, i32* @O_RDWR
%7 = load i32, i32* @O_SYNC
%8 = or i32 %7, %6
%9 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.16, i64 0, i64 0))
br label %64
13: ; preds = %3
%14 = load i32, i32* @PROT_READ
%15 = load i32, i32* @PROT_WRITE
%16 = or i32 %15, %14
%17 = load i32, i32* @MAP_SHARED
%18 = tail call i32* @mmap(i32* null, i32 65535, i32 %16, i32 %17, i32 %9, i32 1107296256)
%19 = tail call i32 @Xil_Out32(i32* %18, i32 %4, i32 0)
br label %20
20: ; preds = %20, %13
%21 = tail call i32 @Xil_In32(i32* %18, i32 %4)
%22 = and i32 %21, 128
%23 = icmp eq i32 %22, 0
br i1 %23, label %20, label %24
24: ; preds = %20
%25 = or i32 %4, 100
%26 = mul i32 %2, %0
%27 = add i32 %26, %1
%28 = tail call i32 @Xil_Out32(i32* %18, i32 %25, i32 %27)
%29 = or i32 %4, 104
%30 = tail call i32 @Xil_Out32(i32* %18, i32 %29, i32 %0)
%31 = or i32 %4, 32
%32 = tail call i32 @Xil_Out32(i32* %18, i32 %31, i32 0)
%33 = or i32 %4, 64
%34 = tail call i32 @Xil_Out32(i32* %18, i32 %33, i32 0)
%35 = or i32 %4, 68
%36 = tail call i32 @Xil_Out32(i32* %18, i32 %35, i32 8176)
%37 = tail call i32 @Xil_In32(i32* %18, i32 %25)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = tail call i32 @Xil_In32(i32* %18, i32 %29)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = tail call i32 @Xil_Out32(i32* %18, i32 %4, i32 2)
%42 = or i32 %4, 4
%43 = tail call i32 @Xil_In32(i32* %18, i32 %42)
%44 = and i32 %43, 32768
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %24
%47 = tail call i32 @Xil_Out32(i32* %18, i32 %42, i32 0)
br label %48
48: ; preds = %46, %24
br label %49
49: ; preds = %58, %48
%50 = tail call i32 @Xil_In32(i32* %18, i32 %4)
%51 = and i32 %50, 7
switch i32 %51, label %58 [
i32 7, label %59
i32 6, label %55
i32 5, label %52
i32 1, label %54
i32 2, label %53
]
52: ; preds = %49
br label %55
53: ; preds = %49
br label %55
54: ; preds = %49
br label %55
55: ; preds = %49, %52, %53, %54
%56 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.12, i64 0, i64 0), %54 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0), %53 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.13, i64 0, i64 0), %52 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.14, i64 0, i64 0), %49 ]
%57 = tail call i32 @puts(i8* dereferenceable(1) %56)
br label %58
58: ; preds = %55, %49
br label %49
59: ; preds = %49
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%62 = tail call i32 @munmap(i32* %18, i32 65535)
%63 = tail call i32 @close(i32 %9)
br label %64
64: ; preds = %59, %11
%65 = phi i32 [ 0, %11 ], [ 1, %59 ]
ret i32 %65
}