#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int PlanePoiseuilleFlow_u(int *iwork, double *rwork, int nPoints, double t,
                          double *x, double *u) {
  int i;
  double h = rwork[0], mu = rwork[1];
  double GradP = rwork[2], q = rwork[3];
  double ys = rwork[5];
  double umax;
  double Y;
  if (GradP != 0.0) {
    umax = -GradP * (1.0 / (2.0 * mu)) * (h * h / 4.0);
  } else if (q != 0.0) {
    umax = (3.0 / 2.0) * q / h;
  } else {
    printf("Please enter input values for either q(Flow Rate per unit depth) "
           "or GradP(Pressure Gradient)\n");
    exit(0);
  }
  for (i = 0; i < nPoints; i++) {
    Y = x[i * 3 + 1] - ys;
    u[i] = (4.0 * umax * Y * (h - Y)) / (h * h);
  }
  return 0;
}


x86 assembly (clang, -O0):
<PlanePoiseuilleFlow_u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a2 <PlanePoiseuilleFlow_u+0x82>
jp     11a2 <PlanePoiseuilleFlow_u+0x82>
jmp    11ff <PlanePoiseuilleFlow_u+0xdf>
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe52(%rip),%xmm2
mulsd  -0x48(%rbp),%xmm2
movsd  0xe3d(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  0xe1b(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1250 <PlanePoiseuilleFlow_u+0x130>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    121c <PlanePoiseuilleFlow_u+0xfc>
jp     121c <PlanePoiseuilleFlow_u+0xfc>
jmp    1238 <PlanePoiseuilleFlow_u+0x118>
movsd  0xddc(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    124b <PlanePoiseuilleFlow_u+0x12b>
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
jmp    1250 <PlanePoiseuilleFlow_u+0x130>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12c9 <PlanePoiseuilleFlow_u+0x1a9>
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xd80(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
subsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1257 <PlanePoiseuilleFlow_u+0x137>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PlanePoiseuilleFlow_u>:
push   %rax
movsd  (%rsi),%xmm0
movsd  0x10(%rsi),%xmm2
movsd  0x28(%rsi),%xmm1
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jne    113b <PlanePoiseuilleFlow_u+0x1b>
jnp    1171 <PlanePoiseuilleFlow_u+0x51>
movsd  0x8(%rsi),%xmm3
addsd  %xmm3,%xmm3
movsd  0xebc(%rip),%xmm4
divsd  %xmm3,%xmm4
mulsd  %xmm2,%xmm4
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  0xeac(%rip),%xmm2
mulsd  %xmm4,%xmm2
test   %edx,%edx
jg     1196 <PlanePoiseuilleFlow_u+0x76>
jmp    12a3 <PlanePoiseuilleFlow_u+0x183>
movsd  0x18(%rsi),%xmm2
ucomisd %xmm3,%xmm2
jne    1182 <PlanePoiseuilleFlow_u+0x62>
jnp    12a7 <PlanePoiseuilleFlow_u+0x187>
mulsd  0xe76(%rip),%xmm2
divsd  %xmm0,%xmm2
test   %edx,%edx
jle    12a3 <PlanePoiseuilleFlow_u+0x183>
mulsd  0xe7a(%rip),%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
mov    %edx,%eax
cmp    $0x3,%edx
jb     11cb <PlanePoiseuilleFlow_u+0xab>
lea    0x8(%rcx),%rsi
lea    (%rax,%rax,2),%rdx
lea    (%rcx,%rdx,8),%rdx
add    $0xfffffffffffffff8,%rdx
cmp    %r8,%rdx
jbe    11d2 <PlanePoiseuilleFlow_u+0xb2>
lea    (%r8,%rax,8),%rdx
cmp    %rdx,%rsi
jae    11d2 <PlanePoiseuilleFlow_u+0xb2>
xor    %edx,%edx
jmp    125b <PlanePoiseuilleFlow_u+0x13b>
mov    %eax,%edx
and    $0x1,%edx
test   %rdx,%rdx
mov    $0x2,%edi
cmovne %rdx,%rdi
mov    %rax,%rdx
sub    %rdi,%rdx
movapd %xmm1,%xmm8
unpcklpd %xmm1,%xmm8
movapd %xmm2,%xmm9
unpcklpd %xmm2,%xmm9
movapd %xmm0,%xmm10
unpcklpd %xmm0,%xmm10
movapd %xmm3,%xmm7
unpcklpd %xmm3,%xmm7
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd 0x10(%rsi),%xmm4
movlpd (%rsi),%xmm4
subpd  %xmm8,%xmm4
movapd %xmm9,%xmm5
mulpd  %xmm4,%xmm5
movapd %xmm10,%xmm6
subpd  %xmm4,%xmm6
mulpd  %xmm5,%xmm6
divpd  %xmm7,%xmm6
movupd %xmm6,(%r8,%rdi,8)
add    $0x2,%rdi
add    $0x30,%rsi
cmp    %rdi,%rdx
jne    1220 <PlanePoiseuilleFlow_u+0x100>
lea    (%rdx,%rdx,2),%rsi
lea    (%rcx,%rsi,8),%rcx
add    $0x8,%rcx
nopw   0x0(%rax,%rax,1)
movsd  (%rcx),%xmm4
subsd  %xmm1,%xmm4
movapd %xmm2,%xmm5
mulsd  %xmm4,%xmm5
movapd %xmm0,%xmm6
subsd  %xmm4,%xmm6
mulsd  %xmm5,%xmm6
divsd  %xmm3,%xmm6
movsd  %xmm6,(%r8,%rdx,8)
add    $0x1,%rdx
add    $0x18,%rcx
cmp    %rdx,%rax
jne    1270 <PlanePoiseuilleFlow_u+0x150>
xor    %eax,%eax
pop    %rcx
ret
lea    0xd72(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [94 x i8] c"Please enter input values for either q(Flow Rate per unit depth) or GradP(Pressure Gradient)\0A\00"
define i32 @PlanePoiseuilleFlow_u(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store i32* %0, i32** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%21 = load double*, double** %8
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
store double %23, double* %14
%24 = load double*, double** %8
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
store double %26, double* %15
%27 = load double*, double** %8
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
store double %29, double* %16
%30 = load double*, double** %8
%31 = getelementptr inbounds double, double* %30, i64 3
%32 = load double, double* %31
store double %32, double* %17
%33 = load double*, double** %8
%34 = getelementptr inbounds double, double* %33, i64 5
%35 = load double, double* %34
store double %35, double* %18
%36 = load double, double* %16
%37 = fcmp une double %36, 0.000000e+00
br i1 %37, label %38, label %50
38: ; preds = %6
%39 = load double, double* %16
%40 = fneg double %39
%41 = load double, double* %15
%42 = fmul double 2.000000e+00, %41
%43 = fdiv double 1.000000e+00, %42
%44 = fmul double %40, %43
%45 = load double, double* %14
%46 = load double, double* %14
%47 = fmul double %45, %46
%48 = fdiv double %47, 4.000000e+00
%49 = fmul double %44, %48
store double %49, double* %19
br label %62
50: ; preds = %6
%51 = load double, double* %17
%52 = fcmp une double %51, 0.000000e+00
br i1 %52, label %53, label %58
53: ; preds = %50
%54 = load double, double* %17
%55 = fmul double 1.500000e+00, %54
%56 = load double, double* %14
%57 = fdiv double %55, %56
store double %57, double* %19
br label %61
58: ; preds = %50
%59 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0))
%60 = call i32 @exit(i32 0)
unreachable
61: ; preds = %53
br label %62
62: ; preds = %61, %38
store i32 0, i32* %13
br label %63
63: ; preds = %93, %62
%64 = load i32, i32* %13
%65 = load i32, i32* %9
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %96
67: ; preds = %63
%68 = load double*, double** %11
%69 = load i32, i32* %13
%70 = mul nsw i32 %69, 3
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %68, i64 %72
%74 = load double, double* %73
%75 = load double, double* %18
%76 = fsub double %74, %75
store double %76, double* %20
%77 = load double, double* %19
%78 = fmul double 4.000000e+00, %77
%79 = load double, double* %20
%80 = fmul double %78, %79
%81 = load double, double* %14
%82 = load double, double* %20
%83 = fsub double %81, %82
%84 = fmul double %80, %83
%85 = load double, double* %14
%86 = load double, double* %14
%87 = fmul double %85, %86
%88 = fdiv double %84, %87
%89 = load double*, double** %12
%90 = load i32, i32* %13
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
store double %88, double* %92
br label %93
93: ; preds = %67
%94 = load i32, i32* %13
%95 = add nsw i32 %94, 1
store i32 %95, i32* %13
br label %63
96: ; preds = %63
ret i32 0
}

LLVM IR (-O2):
@str = [93 x i8] c"Please enter input values for either q(Flow Rate per unit depth) or GradP(Pressure Gradient)\00"
define i32 @PlanePoiseuilleFlow_u(i32* nocapture readnone %0, double* nocapture %1, i32 %2, double %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = load double, double* %1
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 3
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %1, i64 5
%13 = load double, double* %12
%14 = fcmp une double %9, 0.000000e+00
br i1 %14, label %15, label %25
15: ; preds = %6
%16 = getelementptr inbounds double, double* %1, i64 1
%17 = load double, double* %16
%18 = fneg double %9
%19 = fmul double %17, 2.000000e+00
%20 = fdiv double 1.000000e+00, %19
%21 = fmul double %20, %18
%22 = fmul double %7, %7
%23 = fmul double %22, 2.500000e-01
%24 = fmul double %23, %21
br label %33
25: ; preds = %6
%26 = fcmp une double %11, 0.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %25
%28 = fmul double %11, 1.500000e+00
%29 = fdiv double %28, %7
br label %33
30: ; preds = %25
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str, i64 0, i64 0))
%32 = tail call i32 @exit(i32 0)
unreachable
33: ; preds = %27, %15
%34 = phi double [ %24, %15 ], [ %29, %27 ]
%35 = icmp sgt i32 %2, 0
br i1 %35, label %36, label %96
36: ; preds = %33
%37 = fmul double %34, 4.000000e+00
%38 = fmul double %7, %7
%39 = zext i32 %2 to i64
%40 = icmp ult i32 %2, 3
br i1 %40, label %80, label %41
41: ; preds = %36
%42 = getelementptr double, double* %5, i64 %39
%43 = getelementptr double, double* %4, i64 1
%44 = mul nuw nsw i64 %39, 3
%45 = add nsw i64 %44, -1
%46 = getelementptr double, double* %4, i64 %45
%47 = icmp ugt double* %46, %5
%48 = icmp ult double* %43, %42
%49 = and i1 %47, %48
br i1 %49, label %80, label %50
50: ; preds = %41
%51 = and i64 %39, 1
%52 = icmp eq i64 %51, 0
%53 = select i1 %52, i64 2, i64 %51
%54 = sub nsw i64 %39, %53
%55 = insertelement <2 x double> poison, double %13, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%57 = insertelement <2 x double> poison, double %37, i64 0
%58 = shufflevector <2 x double> %57, <2 x double> poison, <2 x i32> zeroinitializer
%59 = insertelement <2 x double> poison, double %7, i64 0
%60 = shufflevector <2 x double> %59, <2 x double> poison, <2 x i32> zeroinitializer
%61 = insertelement <2 x double> poison, double %38, i64 0
%62 = shufflevector <2 x double> %61, <2 x double> poison, <2 x i32> zeroinitializer
br label %63
63: ; preds = %63, %50
%64 = phi i64 [ 0, %50 ], [ %78, %63 ]
%65 = mul nuw nsw i64 %64, 3
%66 = or i64 %65, 1
%67 = getelementptr inbounds double, double* %4, i64 %66
%68 = bitcast double* %67 to <6 x double>*
%69 = load <6 x double>, <6 x double>* %68
%70 = shufflevector <6 x double> %69, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%71 = fsub <2 x double> %70, %56
%72 = fmul <2 x double> %58, %71
%73 = fsub <2 x double> %60, %71
%74 = fmul <2 x double> %72, %73
%75 = fdiv <2 x double> %74, %62
%76 = getelementptr inbounds double, double* %5, i64 %64
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %75, <2 x double>* %77
%78 = add nuw i64 %64, 2
%79 = icmp eq i64 %78, %54
br i1 %79, label %80, label %63
80: ; preds = %63, %41, %36
%81 = phi i64 [ 0, %41 ], [ 0, %36 ], [ %54, %63 ]
br label %82
82: ; preds = %80, %82
%83 = phi i64 [ %94, %82 ], [ %81, %80 ]
%84 = mul nuw nsw i64 %83, 3
%85 = add nuw nsw i64 %84, 1
%86 = getelementptr inbounds double, double* %4, i64 %85
%87 = load double, double* %86
%88 = fsub double %87, %13
%89 = fmul double %37, %88
%90 = fsub double %7, %88
%91 = fmul double %89, %90
%92 = fdiv double %91, %38
%93 = getelementptr inbounds double, double* %5, i64 %83
store double %92, double* %93
%94 = add nuw nsw i64 %83, 1
%95 = icmp eq i64 %94, %39
br i1 %95, label %96, label %82
96: ; preds = %82, %33
ret i32 0
}