#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 backvalue(int, int, int, int, int, int, double, int);
void golden(int t, int r, int f1, int f2, int e, int a, int actn, double ul,
            double um, double ur, double vm, double *umax, double *vmax) {
  double u0, u1, u2, u3;
  double v1, v2;
  u0 = ul;
  u3 = ur;
  if ((ur - um) > (um - ul)) {
    u1 = um;
    v1 = vm;
    u2 = um + 0.38196601 * (ur - um);
    v2 = backvalue(t, r, f1, f2, e, a, u2, actn);
  } else {
    u2 = um;
    v2 = vm;
    u1 = um - 0.38196601 * (um - ul);
    v1 = backvalue(t, r, f1, f2, e, a, u1, actn);
  }
  while ((u3 - u0) > 1.0e-3) {
    if (v2 > v1) {
      (u0) = (u1);
      (u1) = (u2);
      (u2) = (0.61803399 * u1 + 0.38196601 * u3);
      ;
      v1 = v2;
      v2 = backvalue(t, r, f1, f2, e, a, u2, actn);
    } else {
      (u3) = (u2);
      (u2) = (u1);
      (u1) = (0.61803399 * u2 + 0.38196601 * u0);
      ;
      v2 = v1;
      v1 = backvalue(t, r, f1, f2, e, a, u1, actn);
    }
  }
  if (v1 > v2) {
    *umax = u1;
    *vmax = v1;
  } else {
    *umax = u2;
    *vmax = v2;
  }
  return;
}


x86 assembly (clang, -O0):
<golden>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e3 <golden+0xd3>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xe60(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
movsd  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <backvalue@plt>
movsd  %xmm0,-0x68(%rbp)
jmp    1244 <golden+0x134>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xdf2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
movsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <backvalue@plt>
movsd  %xmm0,-0x60(%rbp)
jmp    1249 <golden+0x139>
movsd  -0x58(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  0xdb5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    135b <golden+0x24b>
movsd  -0x68(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    12e8 <golden+0x1d8>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xd72(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
movsd  0xd75(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
movsd  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <backvalue@plt>
movsd  %xmm0,-0x68(%rbp)
jmp    1356 <golden+0x246>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xcff(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  0xd02(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
movsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <backvalue@plt>
movsd  %xmm0,-0x60(%rbp)
jmp    1249 <golden+0x139>
movsd  -0x60(%rbp),%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    138a <golden+0x27a>
movsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13a4 <golden+0x294>
movsd  -0x50(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<golden>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm3,0x8(%rsp)
movapd %xmm2,%xmm3
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x80(%rsp),%eax
movsd  %xmm2,0x20(%rsp)
subsd  %xmm1,%xmm3
movapd %xmm1,%xmm2
movsd  %xmm0,0x18(%rsp)
subsd  %xmm0,%xmm2
ucomisd %xmm2,%xmm3
movapd %xmm1,0x30(%rsp)
jbe    11a9 <golden+0x99>
mulsd  0xe9d(%rip),%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
movapd %xmm3,%xmm0
call   1030 <backvalue@plt>
movsd  0x8(%rsp),%xmm6
movapd 0x30(%rsp),%xmm5
movsd  0x10(%rsp),%xmm2
movapd %xmm0,%xmm1
jmp    11ed <golden+0xdd>
mulsd  0xe4f(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
movapd %xmm2,%xmm0
call   1030 <backvalue@plt>
movsd  0x10(%rsp),%xmm5
movapd 0x30(%rsp),%xmm2
movapd %xmm0,%xmm6
movsd  0x8(%rsp),%xmm1
movsd  0x20(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0x18(%rsp),%xmm3
subsd  %xmm3,%xmm0
ucomisd 0xe07(%rip),%xmm0
jbe    1343 <golden+0x233>
mov    0x80(%rsp),%eax
jmp    12b5 <golden+0x1a5>
nopl   0x0(%rax,%rax,1)
movapd %xmm3,%xmm0
mulsd  0xddc(%rip),%xmm0
movapd %xmm5,%xmm1
mulsd  0xde0(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movapd %xmm1,0x20(%rsp)
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
movsd  %xmm3,0x18(%rsp)
movsd  %xmm6,0x8(%rsp)
call   1030 <backvalue@plt>
movapd 0x20(%rsp),%xmm7
movsd  0x8(%rsp),%xmm5
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
mov    0x80(%rsp),%eax
movapd %xmm0,%xmm6
movapd 0x30(%rsp),%xmm4
movapd %xmm5,%xmm0
movapd %xmm4,%xmm1
subsd  %xmm3,%xmm1
ucomisd 0xd69(%rip),%xmm1
movapd %xmm5,%xmm1
movapd %xmm7,%xmm5
jbe    134b <golden+0x23b>
ucomisd %xmm6,%xmm1
movsd  %xmm5,0x10(%rsp)
movapd %xmm2,0x30(%rsp)
jbe    1220 <golden+0x110>
movapd %xmm4,%xmm0
mulsd  0xd31(%rip),%xmm0
movapd %xmm2,%xmm3
mulsd  0xd35(%rip),%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
movsd  %xmm3,0x18(%rsp)
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
movsd  %xmm1,0x8(%rsp)
movsd  %xmm4,0x20(%rsp)
call   1030 <backvalue@plt>
movsd  0x20(%rsp),%xmm4
movsd  0x8(%rsp),%xmm6
mov    0x80(%rsp),%eax
movapd %xmm0,%xmm5
movsd  0x10(%rsp),%xmm3
movapd 0x30(%rsp),%xmm7
movsd  0x18(%rsp),%xmm2
jmp    1293 <golden+0x183>
movapd %xmm5,%xmm7
movapd %xmm1,%xmm0
movapd %xmm0,%xmm1
cmpltsd %xmm6,%xmm1
andpd  %xmm1,%xmm7
andnpd %xmm2,%xmm1
orpd   %xmm7,%xmm1
maxsd  %xmm0,%xmm6
mov    0x88(%rsp),%rax
movlpd %xmm1,(%rax)
mov    0x90(%rsp),%rax
movsd  %xmm6,(%rax)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @golden(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, double %7, double %8, double %9, double %10, double* %11, double* %12) {
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double*
%26 = alloca double*
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
store i32 %0, i32* %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store i32 %3, i32* %17
store i32 %4, i32* %18
store i32 %5, i32* %19
store i32 %6, i32* %20
store double %7, double* %21
store double %8, double* %22
store double %9, double* %23
store double %10, double* %24
store double* %11, double** %25
store double* %12, double** %26
%33 = load double, double* %21
store double %33, double* %27
%34 = load double, double* %23
store double %34, double* %30
%35 = load double, double* %23
%36 = load double, double* %22
%37 = fsub double %35, %36
%38 = load double, double* %22
%39 = load double, double* %21
%40 = fsub double %38, %39
%41 = fcmp ogt double %37, %40
br i1 %41, label %42, label %59
42: ; preds = %13
%43 = load double, double* %22
store double %43, double* %28
%44 = load double, double* %24
store double %44, double* %31
%45 = load double, double* %22
%46 = load double, double* %23
%47 = load double, double* %22
%48 = fsub double %46, %47
%49 = call double @llvm.fmuladd.f64(double 0x3FD8722190488D0D, double %48, double %45)
store double %49, double* %29
%50 = load i32, i32* %14
%51 = load i32, i32* %15
%52 = load i32, i32* %16
%53 = load i32, i32* %17
%54 = load i32, i32* %18
%55 = load i32, i32* %19
%56 = load double, double* %29
%57 = load i32, i32* %20
%58 = call double @backvalue(i32 %50, i32 %51, i32 %52, i32 %53, i32 %54, i32 %55, double %56, i32 %57)
store double %58, double* %32
br label %76
59: ; preds = %13
%60 = load double, double* %22
store double %60, double* %29
%61 = load double, double* %24
store double %61, double* %32
%62 = load double, double* %22
%63 = load double, double* %22
%64 = load double, double* %21
%65 = fsub double %63, %64
%66 = call double @llvm.fmuladd.f64(double 0xBFD8722190488D0D, double %65, double %62)
store double %66, double* %28
%67 = load i32, i32* %14
%68 = load i32, i32* %15
%69 = load i32, i32* %16
%70 = load i32, i32* %17
%71 = load i32, i32* %18
%72 = load i32, i32* %19
%73 = load double, double* %28
%74 = load i32, i32* %20
%75 = call double @backvalue(i32 %67, i32 %68, i32 %69, i32 %70, i32 %71, i32 %72, double %73, i32 %74)
store double %75, double* %31
br label %76
76: ; preds = %59, %42
br label %77
77: ; preds = %120, %76
%78 = load double, double* %30
%79 = load double, double* %27
%80 = fsub double %78, %79
%81 = fcmp ogt double %80, 1.000000e-03
br i1 %81, label %82, label %121
82: ; preds = %77
%83 = load double, double* %32
%84 = load double, double* %31
%85 = fcmp ogt double %83, %84
br i1 %85, label %86, label %103
86: ; preds = %82
%87 = load double, double* %28
store double %87, double* %27
%88 = load double, double* %29
store double %88, double* %28
%89 = load double, double* %28
%90 = load double, double* %30
%91 = fmul double 0x3FD8722190488D0D, %90
%92 = call double @llvm.fmuladd.f64(double 0x3FE3C6EF37DBB97A, double %89, double %91)
store double %92, double* %29
%93 = load double, double* %32
store double %93, double* %31
%94 = load i32, i32* %14
%95 = load i32, i32* %15
%96 = load i32, i32* %16
%97 = load i32, i32* %17
%98 = load i32, i32* %18
%99 = load i32, i32* %19
%100 = load double, double* %29
%101 = load i32, i32* %20
%102 = call double @backvalue(i32 %94, i32 %95, i32 %96, i32 %97, i32 %98, i32 %99, double %100, i32 %101)
store double %102, double* %32
br label %120
103: ; preds = %82
%104 = load double, double* %29
store double %104, double* %30
%105 = load double, double* %28
store double %105, double* %29
%106 = load double, double* %29
%107 = load double, double* %27
%108 = fmul double 0x3FD8722190488D0D, %107
%109 = call double @llvm.fmuladd.f64(double 0x3FE3C6EF37DBB97A, double %106, double %108)
store double %109, double* %28
%110 = load double, double* %31
store double %110, double* %32
%111 = load i32, i32* %14
%112 = load i32, i32* %15
%113 = load i32, i32* %16
%114 = load i32, i32* %17
%115 = load i32, i32* %18
%116 = load i32, i32* %19
%117 = load double, double* %28
%118 = load i32, i32* %20
%119 = call double @backvalue(i32 %111, i32 %112, i32 %113, i32 %114, i32 %115, i32 %116, double %117, i32 %118)
store double %119, double* %31
br label %120
120: ; preds = %103, %86
br label %77
121: ; preds = %77
%122 = load double, double* %31
%123 = load double, double* %32
%124 = fcmp ogt double %122, %123
br i1 %124, label %125, label %130
125: ; preds = %121
%126 = load double, double* %28
%127 = load double*, double** %25
store double %126, double* %127
%128 = load double, double* %31
%129 = load double*, double** %26
store double %128, double* %129
br label %135
130: ; preds = %121
%131 = load double, double* %29
%132 = load double*, double** %25
store double %131, double* %132
%133 = load double, double* %32
%134 = load double*, double** %26
store double %133, double* %134
br label %135
135: ; preds = %130, %125
ret void
}

LLVM IR (-O2):
define void @golden(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, double %7, double %8, double %9, double %10, double* nocapture writeonly %11, double* nocapture writeonly %12) {
%14 = fsub double %9, %8
%15 = fsub double %8, %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = tail call double @llvm.fmuladd.f64(double %14, double 0x3FD8722190488D0D, double %8)
%19 = tail call double @backvalue(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, double %18, i32 %6)
br label %23
20: ; preds = %13
%21 = tail call double @llvm.fmuladd.f64(double %15, double 0xBFD8722190488D0D, double %8)
%22 = tail call double @backvalue(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, double %21, i32 %6)
br label %23
23: ; preds = %20, %17
%24 = phi double [ %8, %17 ], [ %21, %20 ]
%25 = phi double [ %18, %17 ], [ %8, %20 ]
%26 = phi double [ %10, %17 ], [ %22, %20 ]
%27 = phi double [ %19, %17 ], [ %10, %20 ]
%28 = fsub double %9, %7
%29 = fcmp ogt double %28, 1.000000e-03
br i1 %29, label %30, label %55
30: ; preds = %23, %46
%31 = phi double [ %52, %46 ], [ %27, %23 ]
%32 = phi double [ %51, %46 ], [ %26, %23 ]
%33 = phi double [ %50, %46 ], [ %9, %23 ]
%34 = phi double [ %49, %46 ], [ %25, %23 ]
%35 = phi double [ %48, %46 ], [ %24, %23 ]
%36 = phi double [ %47, %46 ], [ %7, %23 ]
%37 = fcmp ogt double %31, %32
br i1 %37, label %38, label %42
38: ; preds = %30
%39 = fmul double %33, 0x3FD8722190488D0D
%40 = tail call double @llvm.fmuladd.f64(double %34, double 0x3FE3C6EF37DBB97A, double %39)
%41 = tail call double @backvalue(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, double %40, i32 %6)
br label %46
42: ; preds = %30
%43 = fmul double %36, 0x3FD8722190488D0D
%44 = tail call double @llvm.fmuladd.f64(double %35, double 0x3FE3C6EF37DBB97A, double %43)
%45 = tail call double @backvalue(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, double %44, i32 %6)
br label %46
46: ; preds = %42, %38
%47 = phi double [ %35, %38 ], [ %36, %42 ]
%48 = phi double [ %34, %38 ], [ %44, %42 ]
%49 = phi double [ %40, %38 ], [ %35, %42 ]
%50 = phi double [ %33, %38 ], [ %34, %42 ]
%51 = phi double [ %31, %38 ], [ %45, %42 ]
%52 = phi double [ %41, %38 ], [ %32, %42 ]
%53 = fsub double %50, %47
%54 = fcmp ogt double %53, 1.000000e-03
br i1 %54, label %30, label %55
55: ; preds = %46, %23
%56 = phi double [ %24, %23 ], [ %48, %46 ]
%57 = phi double [ %25, %23 ], [ %49, %46 ]
%58 = phi double [ %26, %23 ], [ %51, %46 ]
%59 = phi double [ %27, %23 ], [ %52, %46 ]
%60 = fcmp ogt double %58, %59
%61 = select i1 %60, double %56, double %57
%62 = select i1 %60, double %58, double %59
store double %61, double* %11
store double %62, double* %12
ret void
}