#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 */
double *_ada_phc_sys_rw(int, int, double *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void *call_phc_rw(int n, int rw, double *x) {
  int i, buffer_size = n;
  double *p;
  if (rw == 0) {
    p = _ada_phc_sys_rw(0, buffer_size, x);
    for (i = 0; i < n; i++)
      x[i] = p[i];
    fflush(stdout);
    printf("\nHere is the system :\n");
    _ada_phc_sys_rw(1, buffer_size, x);
  } else
    _ada_phc_sys_rw(1, buffer_size, x);
}


x86 assembly (clang, -O0):
<call_phc_rw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11cf <call_phc_rw+0x9f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rdx
xor    %edi,%edi
call   1040 <_ada_phc_sys_rw@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119f <call_phc_rw+0x6f>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116b <call_phc_rw+0x3b>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x1,%edi
call   1040 <_ada_phc_sys_rw@plt>
jmp    11e0 <call_phc_rw+0xb0>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x1,%edi
call   1040 <_ada_phc_sys_rw@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_phc_rw>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %edi,%r14d
test   %esi,%esi
jne    12df <call_phc_rw+0x1af>
xor    %edi,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <_ada_phc_sys_rw@plt>
test   %r14d,%r14d
jle    12c5 <call_phc_rw+0x195>
mov    %r14d,%ecx
cmp    $0x4,%r14d
jb     1177 <call_phc_rw+0x47>
lea    (%rax,%rcx,8),%rdx
cmp    %rbx,%rdx
jbe    11ec <call_phc_rw+0xbc>
lea    (%rbx,%rcx,8),%rdx
cmp    %rdx,%rax
jae    11ec <call_phc_rw+0xbc>
xor    %edx,%edx
mov    %rdx,%rsi
not    %rsi
add    %rcx,%rsi
mov    %rcx,%rdi
and    $0x3,%rdi
je     11a4 <call_phc_rw+0x74>
nopl   0x0(%rax,%rax,1)
movsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,(%rbx,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rdi
jne    1190 <call_phc_rw+0x60>
cmp    $0x3,%rsi
jb     12c5 <call_phc_rw+0x195>
xchg   %ax,%ax
movsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,(%rbx,%rdx,8)
movsd  0x8(%rax,%rdx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rdx,8)
movsd  0x10(%rax,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rdx,8)
movsd  0x18(%rax,%rdx,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%rcx
jne    11b0 <call_phc_rw+0x80>
jmp    12c5 <call_phc_rw+0x195>
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rsi
mov    %rsi,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%r8d
and    $0x3,%r8d
cmp    $0xc,%rsi
jae    1211 <call_phc_rw+0xe1>
xor    %ebp,%ebp
jmp    1278 <call_phc_rw+0x148>
and    $0xfffffffffffffffc,%rdi
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movups (%rax,%rbp,8),%xmm0
movups 0x10(%rax,%rbp,8),%xmm1
movups %xmm0,(%rbx,%rbp,8)
movups %xmm1,0x10(%rbx,%rbp,8)
movups 0x20(%rax,%rbp,8),%xmm0
movups 0x30(%rax,%rbp,8),%xmm1
movups %xmm0,0x20(%rbx,%rbp,8)
movups %xmm1,0x30(%rbx,%rbp,8)
movups 0x40(%rax,%rbp,8),%xmm0
movups 0x50(%rax,%rbp,8),%xmm1
movups %xmm0,0x40(%rbx,%rbp,8)
movups %xmm1,0x50(%rbx,%rbp,8)
movups 0x60(%rax,%rbp,8),%xmm0
movups 0x70(%rax,%rbp,8),%xmm1
movups %xmm0,0x60(%rbx,%rbp,8)
movups %xmm1,0x70(%rbx,%rbp,8)
add    $0x10,%rbp
add    $0xfffffffffffffffc,%rdi
jne    1220 <call_phc_rw+0xf0>
test   %r8,%r8
je     12bc <call_phc_rw+0x18c>
lea    (%rbx,%rbp,8),%rdi
add    $0x10,%rdi
lea    (%rax,%rbp,8),%rbp
add    $0x10,%rbp
shl    $0x5,%r8
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rbp,%rsi,1),%xmm0
movups 0x0(%rbp,%rsi,1),%xmm1
movups %xmm0,-0x10(%rdi,%rsi,1)
movups %xmm1,(%rdi,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r8
jne    12a0 <call_phc_rw+0x170>
cmp    %rcx,%rdx
jne    1179 <call_phc_rw+0x49>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xd26(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <_ada_phc_sys_rw@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [23 x i8] c"\0AHere is the system :\0A\00"
define i8* @call_phc_rw(i32 %0, i32 %1, double* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
%11 = load i32, i32* %5
store i32 %11, i32* %9
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %42
14: ; preds = %3
%15 = load i32, i32* %9
%16 = load double*, double** %7
%17 = call double* @_ada_phc_sys_rw(i32 0, i32 %15, double* %16)
store double* %17, double** %10
store i32 0, i32* %8
br label %18
18: ; preds = %32, %14
%19 = load i32, i32* %8
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = load double*, double** %10
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = load double*, double** %7
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
store double %27, double* %31
br label %32
32: ; preds = %22
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %18
35: ; preds = %18
%36 = load i32, i32* @stdout
%37 = call i32 @fflush(i32 %36)
%38 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%39 = load i32, i32* %9
%40 = load double*, double** %7
%41 = call double* @_ada_phc_sys_rw(i32 1, i32 %39, double* %40)
br label %46
42: ; preds = %3
%43 = load i32, i32* %9
%44 = load double*, double** %7
%45 = call double* @_ada_phc_sys_rw(i32 1, i32 %43, double* %44)
br label %46
46: ; preds = %42, %35
%47 = load i8*, i8** %4
ret i8* %47
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [22 x i8] c"\0AHere is the system :\00"
define noalias i8* @call_phc_rw(i32 %0, i32 %1, double* %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %137
5: ; preds = %3
%6 = tail call double* @_ada_phc_sys_rw(i32 0, i32 %0, double* %2)
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %133
8: ; preds = %5
%9 = zext i32 %0 to i64
%10 = icmp ult i32 %0, 4
br i1 %10, label %96, label %11
11: ; preds = %8
%12 = getelementptr double, double* %2, i64 %9
%13 = getelementptr double, double* %6, i64 %9
%14 = icmp ugt double* %13, %2
%15 = icmp ult double* %6, %12
%16 = and i1 %14, %15
br i1 %16, label %96, label %17
17: ; preds = %11
%18 = and i64 %9, 4294967292
%19 = add nsw i64 %18, -4
%20 = lshr exact i64 %19, 2
%21 = add nuw nsw i64 %20, 1
%22 = and i64 %21, 3
%23 = icmp ult i64 %19, 12
br i1 %23, label %75, label %24
24: ; preds = %17
%25 = and i64 %21, 9223372036854775804
br label %26
26: ; preds = %26, %24
%27 = phi i64 [ 0, %24 ], [ %72, %26 ]
%28 = phi i64 [ 0, %24 ], [ %73, %26 ]
%29 = getelementptr inbounds double, double* %6, i64 %27
%30 = bitcast double* %29 to <2 x double>*
%31 = load <2 x double>, <2 x double>* %30
%32 = getelementptr inbounds double, double* %29, i64 2
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = getelementptr inbounds double, double* %2, i64 %27
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> %31, <2 x double>* %36
%37 = getelementptr inbounds double, double* %35, i64 2
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> %34, <2 x double>* %38
%39 = or i64 %27, 4
%40 = getelementptr inbounds double, double* %6, i64 %39
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr inbounds double, double* %40, i64 2
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = getelementptr inbounds double, double* %2, i64 %39
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> %42, <2 x double>* %47
%48 = getelementptr inbounds double, double* %46, i64 2
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %45, <2 x double>* %49
%50 = or i64 %27, 8
%51 = getelementptr inbounds double, double* %6, i64 %50
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %51, i64 2
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %2, i64 %50
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %53, <2 x double>* %58
%59 = getelementptr inbounds double, double* %57, i64 2
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %56, <2 x double>* %60
%61 = or i64 %27, 12
%62 = getelementptr inbounds double, double* %6, i64 %61
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = getelementptr inbounds double, double* %62, i64 2
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = getelementptr inbounds double, double* %2, i64 %61
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %64, <2 x double>* %69
%70 = getelementptr inbounds double, double* %68, i64 2
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %67, <2 x double>* %71
%72 = add nuw i64 %27, 16
%73 = add nuw i64 %28, 4
%74 = icmp eq i64 %73, %25
br i1 %74, label %75, label %26
75: ; preds = %26, %17
%76 = phi i64 [ 0, %17 ], [ %72, %26 ]
%77 = icmp eq i64 %22, 0
br i1 %77, label %94, label %78
78: ; preds = %75, %78
%79 = phi i64 [ %91, %78 ], [ %76, %75 ]
%80 = phi i64 [ %92, %78 ], [ 0, %75 ]
%81 = getelementptr inbounds double, double* %6, i64 %79
%82 = bitcast double* %81 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = getelementptr inbounds double, double* %81, i64 2
%85 = bitcast double* %84 to <2 x double>*
%86 = load <2 x double>, <2 x double>* %85
%87 = getelementptr inbounds double, double* %2, i64 %79
%88 = bitcast double* %87 to <2 x double>*
store <2 x double> %83, <2 x double>* %88
%89 = getelementptr inbounds double, double* %87, i64 2
%90 = bitcast double* %89 to <2 x double>*
store <2 x double> %86, <2 x double>* %90
%91 = add nuw i64 %79, 4
%92 = add i64 %80, 1
%93 = icmp eq i64 %92, %22
br i1 %93, label %94, label %78
94: ; preds = %78, %75
%95 = icmp eq i64 %18, %9
br i1 %95, label %133, label %96
96: ; preds = %11, %8, %94
%97 = phi i64 [ 0, %11 ], [ 0, %8 ], [ %18, %94 ]
%98 = xor i64 %97, -1
%99 = add nsw i64 %98, %9
%100 = and i64 %9, 3
%101 = icmp eq i64 %100, 0
br i1 %101, label %111, label %102
102: ; preds = %96, %102
%103 = phi i64 [ %108, %102 ], [ %97, %96 ]
%104 = phi i64 [ %109, %102 ], [ 0, %96 ]
%105 = getelementptr inbounds double, double* %6, i64 %103
%106 = load double, double* %105
%107 = getelementptr inbounds double, double* %2, i64 %103
store double %106, double* %107
%108 = add nuw nsw i64 %103, 1
%109 = add i64 %104, 1
%110 = icmp eq i64 %109, %100
br i1 %110, label %111, label %102
111: ; preds = %102, %96
%112 = phi i64 [ %97, %96 ], [ %108, %102 ]
%113 = icmp ult i64 %99, 3
br i1 %113, label %133, label %114
114: ; preds = %111, %114
%115 = phi i64 [ %131, %114 ], [ %112, %111 ]
%116 = getelementptr inbounds double, double* %6, i64 %115
%117 = load double, double* %116
%118 = getelementptr inbounds double, double* %2, i64 %115
store double %117, double* %118
%119 = add nuw nsw i64 %115, 1
%120 = getelementptr inbounds double, double* %6, i64 %119
%121 = load double, double* %120
%122 = getelementptr inbounds double, double* %2, i64 %119
store double %121, double* %122
%123 = add nuw nsw i64 %115, 2
%124 = getelementptr inbounds double, double* %6, i64 %123
%125 = load double, double* %124
%126 = getelementptr inbounds double, double* %2, i64 %123
store double %125, double* %126
%127 = add nuw nsw i64 %115, 3
%128 = getelementptr inbounds double, double* %6, i64 %127
%129 = load double, double* %128
%130 = getelementptr inbounds double, double* %2, i64 %127
store double %129, double* %130
%131 = add nuw nsw i64 %115, 4
%132 = icmp eq i64 %131, %9
br i1 %132, label %133, label %114
133: ; preds = %111, %114, %94, %5
%134 = load i32, i32* @stdout
%135 = tail call i32 @fflush(i32 %134)
%136 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %137
137: ; preds = %3, %133
%138 = tail call double* @_ada_phc_sys_rw(i32 1, i32 %0, double* %2)
ret i8* undef
}