float Fmax(R, z, vR, vz, vlimit, vpmax)
float R, z, vR, vz;
float *vpmax, vlimit;
{
  int i;
  float v, dv, fmax, vmax, v0;
  float Fdisk();
  dv = 2.0 * vlimit / 100;
  v0 = *vpmax - 50 * dv;
  fmax = Fdisk(vR, v0, vz, R, z);
  for (i = 0; i < 100; i++) {
    float ftry, vtry;
    vtry = v0 + i * dv;
    ftry = Fdisk(vR, vtry, vz, R, z);
    if (ftry > fmax) {
      fmax = ftry;
      vmax = vtry;
    }
  }
  *vpmax = vmax;
  return fmax;
}


x86 assembly (clang, -O0):
<Fmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm4,-0x48(%rbp)
movsd  %xmm3,-0x50(%rbp)
movaps %xmm1,%xmm3
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm4
movsd  -0x48(%rbp),%xmm0
cvtsd2ss %xmm4,%xmm4
cvtsd2ss %xmm3,%xmm3
cvtsd2ss %xmm2,%xmm2
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm4,-0x4(%rbp)
movss  %xmm3,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %rdi,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
movss  -0x2c(%rbp),%xmm0
movss  0xe5e(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x38(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x4(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x8(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
mov    $0x5,%al
call   1030 <Fdisk@plt>
movss  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    1284 <Fmax+0x174>
movss  -0x38(%rbp),%xmm1
cvtsi2ssl -0x24(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x4(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x8(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
mov    $0x5,%al
call   1030 <Fdisk@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
ucomiss -0x30(%rbp),%xmm0
jbe    1271 <Fmax+0x161>
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1276 <Fmax+0x166>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ef <Fmax+0xdf>
movss  -0x34(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fmax>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
cvtsd2ss %xmm0,%xmm6
cvtsd2ss %xmm1,%xmm5
xorps  %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtsd2ss %xmm3,%xmm2
xorps  %xmm3,%xmm3
cvtsd2ss %xmm4,%xmm3
cvtss2sd %xmm3,%xmm3
addsd  %xmm3,%xmm3
divsd  0xebd(%rip),%xmm3
mov    %rdi,%rbx
cvtsd2ss %xmm3,%xmm3
movss  0xeb6(%rip),%xmm4
movss  %xmm3,0x8(%rsp)
mulss  %xmm3,%xmm4
addss  (%rdi),%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movss  %xmm4,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
cvtss2sd %xmm2,%xmm2
xorps  %xmm3,%xmm3
cvtss2sd %xmm6,%xmm3
xorps  %xmm4,%xmm4
cvtss2sd %xmm5,%xmm4
movsd  %xmm0,0x28(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm4,0x10(%rsp)
mov    $0x5,%al
call   1030 <Fdisk@plt>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movaps %xmm1,0x40(%rsp)
xorps  %xmm2,%xmm2
cvtsi2ss %ebp,%xmm2
movss  %xmm0,0xc(%rsp)
mulss  0x8(%rsp),%xmm2
addss  0x4(%rsp),%xmm2
movaps %xmm2,0x30(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
mov    $0x5,%al
call   1030 <Fdisk@plt>
movss  0xc(%rsp),%xmm2
movaps %xmm2,%xmm1
cmpltss %xmm0,%xmm1
movaps 0x30(%rsp),%xmm3
andps  %xmm1,%xmm3
andnps 0x40(%rsp),%xmm1
orps   %xmm3,%xmm1
maxss  %xmm2,%xmm0
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    11b0 <Fmax+0xa0>
movss  %xmm1,(%rbx)
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @Fmax(double %0, double %1, double %2, double %3, double %4, float* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float*
%13 = alloca i32
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = fptrunc double %0 to float
%22 = fptrunc double %1 to float
%23 = fptrunc double %2 to float
%24 = fptrunc double %3 to float
%25 = fptrunc double %4 to float
store float %21, float* %7
store float %22, float* %8
store float %23, float* %9
store float %24, float* %10
store float %25, float* %11
store float* %5, float** %12
%26 = load float, float* %11
%27 = fpext float %26 to double
%28 = fmul double 2.000000e+00, %27
%29 = fdiv double %28, 1.000000e+02
%30 = fptrunc double %29 to float
store float %30, float* %15
%31 = load float*, float** %12
%32 = load float, float* %31
%33 = load float, float* %15
%34 = call float @llvm.fmuladd.f32(float -5.000000e+01, float %33, float %32)
store float %34, float* %18
%35 = load float, float* %9
%36 = fpext float %35 to double
%37 = load float, float* %18
%38 = fpext float %37 to double
%39 = load float, float* %10
%40 = fpext float %39 to double
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = load float, float* %8
%44 = fpext float %43 to double
%45 = call float (double, double, double, double, double, ...) bitcast (float (...)* @Fdisk to float (double, double, double, double, double, ...)*)(double %36, double %38, double %40, double %42, double %44)
store float %45, float* %16
store i32 0, i32* %13
br label %46
46: ; preds = %73, %6
%47 = load i32, i32* %13
%48 = icmp slt i32 %47, 100
br i1 %48, label %49, label %76
49: ; preds = %46
%50 = load float, float* %18
%51 = load i32, i32* %13
%52 = sitofp i32 %51 to float
%53 = load float, float* %15
%54 = call float @llvm.fmuladd.f32(float %52, float %53, float %50)
store float %54, float* %20
%55 = load float, float* %9
%56 = fpext float %55 to double
%57 = load float, float* %20
%58 = fpext float %57 to double
%59 = load float, float* %10
%60 = fpext float %59 to double
%61 = load float, float* %7
%62 = fpext float %61 to double
%63 = load float, float* %8
%64 = fpext float %63 to double
%65 = call float (double, double, double, double, double, ...) bitcast (float (...)* @Fdisk to float (double, double, double, double, double, ...)*)(double %56, double %58, double %60, double %62, double %64)
store float %65, float* %19
%66 = load float, float* %19
%67 = load float, float* %16
%68 = fcmp ogt float %66, %67
br i1 %68, label %69, label %72
69: ; preds = %49
%70 = load float, float* %19
store float %70, float* %16
%71 = load float, float* %20
store float %71, float* %17
br label %72
72: ; preds = %69, %49
br label %73
73: ; preds = %72
%74 = load i32, i32* %13
%75 = add nsw i32 %74, 1
store i32 %75, i32* %13
br label %46
76: ; preds = %46
%77 = load float, float* %17
%78 = load float*, float** %12
store float %77, float* %78
%79 = load float, float* %16
ret float %79
}

LLVM IR (-O2):
define float @Fmax(double %0, double %1, double %2, double %3, double %4, float* nocapture %5) {
%7 = fptrunc double %0 to float
%8 = fptrunc double %1 to float
%9 = fptrunc double %2 to float
%10 = fptrunc double %3 to float
%11 = fptrunc double %4 to float
%12 = fpext float %11 to double
%13 = fmul double %12, 2.000000e+00
%14 = fdiv double %13, 1.000000e+02
%15 = fptrunc double %14 to float
%16 = load float, float* %5
%17 = tail call float @llvm.fmuladd.f32(float %15, float -5.000000e+01, float %16)
%18 = fpext float %9 to double
%19 = fpext float %17 to double
%20 = fpext float %10 to double
%21 = fpext float %7 to double
%22 = fpext float %8 to double
%23 = tail call float (double, double, double, double, double, ...) bitcast (float (...)* @Fdisk to float (double, double, double, double, double, ...)*)(double %18, double %19, double %20, double %21, double %22)
br label %24
24: ; preds = %6, %24
%25 = phi i32 [ 0, %6 ], [ %35, %24 ]
%26 = phi float [ %23, %6 ], [ %34, %24 ]
%27 = phi float [ undef, %6 ], [ %33, %24 ]
%28 = sitofp i32 %25 to float
%29 = tail call float @llvm.fmuladd.f32(float %28, float %15, float %17)
%30 = fpext float %29 to double
%31 = tail call float (double, double, double, double, double, ...) bitcast (float (...)* @Fdisk to float (double, double, double, double, double, ...)*)(double %18, double %30, double %20, double %21, double %22)
%32 = fcmp ogt float %31, %26
%33 = select i1 %32, float %29, float %27
%34 = select i1 %32, float %31, float %26
%35 = add nuw nsw i32 %25, 1
%36 = icmp eq i32 %35, 100
br i1 %36, label %37, label %24
37: ; preds = %24
store float %33, float* %5
ret float %34
}