#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*/ display_progress(int, int, int);
int /*<<< orphan*/ metropolis_update(double *, double, int, int, double);
int /*<<< orphan*/ printf(char *);
double burn_in(double *path, int n_burn, int nt, double g, double D) {
  int burn;
  int n_burn_sweeps = 100;
  printf("Burning in...\n");
  for (burn = 0; burn < n_burn; burn++) {
    metropolis_update(path, g, n_burn_sweeps, nt, D);
    display_progress(burn, n_burn, 250);
  }
  return 0;
}


x86 assembly (clang, -O0):
<burn_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movl   $0x64,-0x28(%rbp)
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a9 <burn_in+0x79>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  -0x20(%rbp),%xmm1
call   1050 <metropolis_update@plt>
mov    -0x24(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0xfa,%edx
call   1040 <display_progress@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1166 <burn_in+0x36>
xorps  %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<burn_in>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1191 <burn_in+0x61>
xor    %ebx,%ebx
mov    %r15,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x64,%esi
mov    %r14d,%edx
movsd  0x10(%rsp),%xmm1
call   1050 <metropolis_update@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0xfa,%edx
call   1040 <display_progress@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1160 <burn_in+0x30>
xorps  %xmm0,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Burning in...\0A\00"
define double @burn_in(double* %0, i32 %1, i32 %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double %3, double* %9
store double %4, double* %10
store i32 100, i32* %12
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %11
br label %14
14: ; preds = %28, %5
%15 = load i32, i32* %11
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = load double*, double** %6
%20 = load double, double* %9
%21 = load i32, i32* %12
%22 = load i32, i32* %8
%23 = load double, double* %10
%24 = call i32 @metropolis_update(double* %19, double %20, i32 %21, i32 %22, double %23)
%25 = load i32, i32* %11
%26 = load i32, i32* %7
%27 = call i32 @display_progress(i32 %25, i32 %26, i32 250)
br label %28
28: ; preds = %18
%29 = load i32, i32* %11
%30 = add nsw i32 %29, 1
store i32 %30, i32* %11
br label %14
31: ; preds = %14
ret double 0.000000e+00
}

LLVM IR (-O2):
@str = [14 x i8] c"Burning in...\00"
define double @burn_in(double* %0, i32 %1, i32 %2, double %3, double %4) {
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %14
8: ; preds = %5, %8
%9 = phi i32 [ %12, %8 ], [ 0, %5 ]
%10 = tail call i32 @metropolis_update(double* %0, double %3, i32 100, i32 %2, double %4)
%11 = tail call i32 @display_progress(i32 %9, i32 %1, i32 250)
%12 = add nuw nsw i32 %9, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %8
14: ; preds = %8, %5
ret double 0.000000e+00
}