accept(temp, step_eval, this_eval, design) struct Design *design;
double temp, step_eval, this_eval;
{
  int i;
  double rnd, prob;
  if (not_too_big(design)) {
    if (step_eval > this_eval) {
      rnd = random() / 2147483647.;
      prob = exp(-(step_eval - this_eval) / temp);
      if (rnd < prob)
        i = 1;
      else
        i = 0;
    } else
      i = 2;
  } else
    i = -1;
  return (i);
}


x86 assembly (clang, -O0):
<accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <not_too_big@plt>
cmp    $0x0,%eax
je     11f3 <accept+0xc3>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11e7 <accept+0xb7>
mov    $0x0,%al
call   1040 <random@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x8(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11db <accept+0xab>
movl   $0x1,-0x24(%rbp)
jmp    11e2 <accept+0xb2>
movl   $0x0,-0x24(%rbp)
jmp    11ee <accept+0xbe>
movl   $0x2,-0x24(%rbp)
jmp    11fa <accept+0xca>
movl   $0xffffffff,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<accept>:
sub    $0x38,%rsp
movsd  %xmm2,0x8(%rsp)
movaps %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1030 <not_too_big@plt>
test   %eax,%eax
je     11ae <accept+0x7e>
mov    $0x2,%eax
movapd 0x20(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    11a9 <accept+0x79>
xor    %eax,%eax
call   1040 <random@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe87(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
xorpd  0xe7d(%rip),%xmm0
divsd  0x18(%rsp),%xmm0
call   1050 <exp@plt>
xor    %eax,%eax
ucomisd 0x10(%rsp),%xmm0
seta   %al
add    $0x38,%rsp
ret
mov    $0xffffffff,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
%struct.Design = type opaque
define i32 @accept(double %0, double %1, double %2, %struct.Design* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca %struct.Design*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store %struct.Design* %3, %struct.Design** %8
%12 = load %struct.Design*, %struct.Design** %8
%13 = call i32 (%struct.Design*, ...) bitcast (i32 (...)* @not_too_big to i32 (%struct.Design*, ...)*)(%struct.Design* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %38
15: ; preds = %4
%16 = load double, double* %6
%17 = load double, double* %7
%18 = fcmp ogt double %16, %17
br i1 %18, label %19, label %36
19: ; preds = %15
%20 = call i32 (...) @random()
%21 = sitofp i32 %20 to double
%22 = fdiv double %21, 0x41DFFFFFFFC00000
store double %22, double* %10
%23 = load double, double* %6
%24 = load double, double* %7
%25 = fsub double %23, %24
%26 = fneg double %25
%27 = load double, double* %5
%28 = fdiv double %26, %27
%29 = call double @exp(double %28)
store double %29, double* %11
%30 = load double, double* %10
%31 = load double, double* %11
%32 = fcmp olt double %30, %31
br i1 %32, label %33, label %34
33: ; preds = %19
store i32 1, i32* %9
br label %35
34: ; preds = %19
store i32 0, i32* %9
br label %35
35: ; preds = %34, %33
br label %37
36: ; preds = %15
store i32 2, i32* %9
br label %37
37: ; preds = %36, %35
br label %39
38: ; preds = %4
store i32 -1, i32* %9
br label %39
39: ; preds = %38, %37
%40 = load i32, i32* %9
ret i32 %40
}

LLVM IR (-O2):
%struct.Design = type opaque
define i32 @accept(double %0, double %1, double %2, %struct.Design* %3) {
%5 = tail call i32 (%struct.Design*, ...) bitcast (i32 (...)* @not_too_big to i32 (%struct.Design*, ...)*)(%struct.Design* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %4
%8 = fcmp ogt double %1, %2
br i1 %8, label %9, label %19
9: ; preds = %7
%10 = tail call i32 (...) @random()
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 0x41DFFFFFFFC00000
%13 = fsub double %1, %2
%14 = fneg double %13
%15 = fdiv double %14, %0
%16 = tail call double @exp(double %15)
%17 = fcmp olt double %12, %16
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %4, %7, %9
%20 = phi i32 [ %18, %9 ], [ 2, %7 ], [ -1, %4 ]
ret i32 %20
}