#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 exp(double);
double calculate_confidence(double score, double start_weight) {
  double conf;
  if (score / start_weight < 41) {
    conf = exp(score / start_weight);
    conf = (conf / (conf + 1)) * 100.0;
  } else
    conf = 99.99;
  if (conf <= 50.00) {
    conf = 50.00;
  }
  return conf;
}


x86 assembly (clang, -O0):
<calculate_confidence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
movsd  0xecc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    117e <calculate_confidence+0x6e>
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    118b <calculate_confidence+0x7b>
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe8d(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11ab <calculate_confidence+0x9b>
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_confidence>:
push   %rax
divsd  %xmm1,%xmm0
movsd  0xeeb(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1142 <calculate_confidence+0x32>
call   1030 <exp@plt>
movsd  0xee0(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
mulsd  0xed8(%rip),%xmm0
jmp    114a <calculate_confidence+0x3a>
movsd  0xeb6(%rip),%xmm0
movsd  0xece(%rip),%xmm1
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @calculate_confidence(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fdiv double %6, %7
%9 = fcmp olt double %8, 4.100000e+01
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = load double, double* %3
%12 = load double, double* %4
%13 = fdiv double %11, %12
%14 = call double @exp(double %13)
store double %14, double* %5
%15 = load double, double* %5
%16 = load double, double* %5
%17 = fadd double %16, 1.000000e+00
%18 = fdiv double %15, %17
%19 = fmul double %18, 1.000000e+02
store double %19, double* %5
br label %21
20: ; preds = %2
store double 0x4058FF5C28F5C28F, double* %5
br label %21
21: ; preds = %20, %10
%22 = load double, double* %5
%23 = fcmp ole double %22, 5.000000e+01
br i1 %23, label %24, label %25
24: ; preds = %21
store double 5.000000e+01, double* %5
br label %25
25: ; preds = %24, %21
%26 = load double, double* %5
ret double %26
}

LLVM IR (-O2):
define double @calculate_confidence(double %0, double %1) {
%3 = fdiv double %0, %1
%4 = fcmp olt double %3, 4.100000e+01
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call double @exp(double %3)
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %6, %7
%9 = fmul double %8, 1.000000e+02
br label %10
10: ; preds = %2, %5
%11 = phi double [ %9, %5 ], [ 0x4058FF5C28F5C28F, %2 ]
%12 = fcmp ole double %11, 5.000000e+01
%13 = select i1 %12, double 5.000000e+01, double %11
ret double %13
}