#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 */
scalar_t__ RAND_MAX;
double atof(int /*<<< orphan*/);
int atoi(int /*<<< orphan*/);
double boltz(double, double);
double cooling(int, double, double);
double dist(int *, int);
int getopt(int, char **, char *);
int *malloc(int);
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ swap(int *, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc < 13) {
    print_usage();
    return 0;
  }
  int c;
  int n_cities;
  int grid_width, grid_height;
  double temp_init, temp_final;
  double tau;
  opterr = 0;
  while ((c = getopt(argc, argv, "n:w:h:i:f:t:")) != -1) {
    switch (c) {
    case 'n':
      n_cities = atoi(optarg);
      break;
    case 'w':
      grid_width = atoi(optarg);
      break;
    case 'h':
      grid_height = atoi(optarg);
      break;
    case 'i':
      temp_init = atof(optarg);
      break;
    case 'f':
      temp_final = atof(optarg);
      break;
    case 't':
      tau = atof(optarg);
      break;
    default:
      print_usage();
      return 1;
    }
  }
  int i, j;
  int *route = malloc(2 * (n_cities + 1) * sizeof(int));
  srand(time(NULL));
  for (i = 0; i < 2 * n_cities; i += 2) {
    route[i] = rand() % grid_width;
    route[i + 1] = rand() % grid_height;
  }
  route[2 * n_cities] = route[0];
  route[2 * n_cities + 1] = route[1];
  int t = 0;
  double dist_now = dist(route, n_cities);
  double dist_prev;
  double temp = temp_final;
  while (temp > temp_init) {
    t++;
    temp = cooling(t, temp_final, tau);
    dist_prev = dist_now;
    i = rand() % n_cities;
    j = rand() % n_cities;
    while (i == j) {
      i = rand() % n_cities;
      j = rand() % n_cities;
    }
    swap(route, i, j);
    dist_now = dist(route, n_cities);
    if ((double)rand() / (double)RAND_MAX > boltz(dist_now - dist_prev, temp)) {
      swap(route, i, j);
      dist_now = dist(route, n_cities);
    }
    if (t % (int)(tau / 10) == 0) {
      printf("%f ", dist_now);
      for (i = 0; i < 2 * n_cities; i += 2)
        printf("%d %d ", route[i], route[i + 1]);
      printf("%d %d\n", route[n_cities], route[n_cities + 1]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xd,-0x8(%rbp)
jge    1206 <main+0x36>
mov    $0x0,%al
call   10d0 <print_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1595 <main+0x3c5>
mov    0x2dc3(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe2e(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     12fe <main+0x12e>
mov    -0x14(%rbp),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0x70(%rbp)
sub    $0x11,%eax
ja     12e6 <main+0x116>
mov    -0x70(%rbp),%rax
lea    0xdb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    12f9 <main+0x129>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    12f9 <main+0x129>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    12f9 <main+0x129>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    12f9 <main+0x129>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    12f9 <main+0x129>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    12f9 <main+0x129>
mov    $0x0,%al
call   10d0 <print_usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1595 <main+0x3c5>
jmp    1214 <main+0x44>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    137f <main+0x1af>
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0x1c(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0x20(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x3c(%rbp)
jmp    132f <main+0x15f>
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1090 <dist@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    158e <main+0x3be>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   10a0 <cooling@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x3c(%rbp)
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    1454 <main+0x284>
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x3c(%rbp)
mov    $0x0,%al
call   10f0 <rand@plt>
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x40(%rbp)
jmp    1427 <main+0x257>
mov    -0x48(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
call   10e0 <swap@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1090 <dist@plt>
movsd  %xmm0,-0x58(%rbp)
mov    $0x0,%al
call   10f0 <rand@plt>
cvtsi2sd %eax,%xmm0
mov    0x2b5a(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
call   1050 <boltz@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14da <main+0x30a>
mov    -0x48(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
call   10e0 <swap@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1090 <dist@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x4c(%rbp),%eax
movsd  -0x38(%rbp),%xmm0
movsd  0xb16(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1589 <main+0x3b9>
cvttsd2si -0x58(%rbp),%esi
lea    0xb53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1560 <main+0x390>
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x48(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xb16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x3c(%rbp)
jmp    1518 <main+0x348>
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xae6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13d1 <main+0x201>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %ebx,%ebx
cmp    $0xd,%edi
jl     14f6 <main+0x326>
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2ddb(%rip),%rax
movq   $0x0,(%rax)
lea    0xe4d(%rip),%rbx
mov    0x2dee(%rip),%r15
lea    0xdf7(%rip),%r12
jmp    122b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15),%edi
call   10c0 <atoi@plt>
mov    %eax,%r13d
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10b0 <getopt@plt>
cmp    $0x6e,%eax
je     1220 <main+0x50>
lea    -0x66(%rax),%ecx
cmp    $0x11,%ecx
ja     129c <main+0xcc>
mov    %r12,%rdx
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    (%r15),%edi
call   1030 <atof@plt>
movsd  %xmm0,0x28(%rsp)
jmp    122b <main+0x5b>
mov    (%r15),%edi
call   10c0 <atoi@plt>
mov    %eax,(%rsp)
jmp    122b <main+0x5b>
mov    (%r15),%edi
call   1030 <atof@plt>
movsd  %xmm0,0x30(%rsp)
jmp    122b <main+0x5b>
mov    (%r15),%edi
call   1030 <atof@plt>
movsd  %xmm0,0x20(%rsp)
jmp    122b <main+0x5b>
mov    (%r15),%edi
call   10c0 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    122b <main+0x5b>
cmp    $0xffffffff,%eax
jne    14f1 <main+0x321>
lea    0x8(,%r13,8),%edi
call   1080 <malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0x0(%r13,%r13,1),%eax
movslq %eax,%rbx
test   %r13d,%r13d
mov    (%rsp),%r12d
mov    0x8(%rsp),%r15d
jle    1308 <main+0x138>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <rand@plt>
cltd
idiv   %r15d
mov    %edx,(%r14,%rbp,4)
xor    %eax,%eax
call   10f0 <rand@plt>
cltd
idiv   %r12d
mov    %edx,0x4(%r14,%rbp,4)
add    $0x2,%rbp
cmp    %rbx,%rbp
jl     12e0 <main+0x110>
mov    (%r14),%eax
mov    %eax,(%r14,%rbx,4)
mov    0x4(%r14),%eax
mov    %ebx,%ecx
or     $0x1,%ecx
movslq %ecx,%rcx
mov    %eax,(%r14,%rcx,4)
mov    %r14,%rdi
mov    %r13d,%esi
call   1090 <dist@plt>
movaps %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
ucomisd 0x30(%rsp),%xmm0
mov    %rbx,%r15
mov    $0x0,%ebx
jbe    14fd <main+0x32d>
movsd  0x20(%rsp),%xmm0
divsd  0xcab(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,0x1c(%rsp)
lea    0x1(%r13),%eax
movslq %r13d,%rcx
mov    %rcx,0x40(%rsp)
cltq
mov    %rax,0x38(%rsp)
xor    %r12d,%r12d
mov    %r15,0x48(%rsp)
jmp    13b8 <main+0x1e8>
nopw   0x0(%rax,%rax,1)
mov    0x40(%rsp),%rax
mov    (%r14,%rax,4),%esi
mov    0x38(%rsp),%rax
mov    (%r14,%rax,4),%edx
lea    0xccf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd 0x30(%rsp),%xmm0
jbe    150e <main+0x33e>
movsd  %xmm1,0x10(%rsp)
add    $0x1,%r12d
mov    %r12d,%ebx
mov    %r12d,%edi
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   10a0 <cooling@plt>
movsd  %xmm0,0x8(%rsp)
nop
xor    %eax,%eax
call   10f0 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10f0 <rand@plt>
cltd
idiv   %r13d
mov    %edx,%r15d
mov    %ebp,%eax
cltd
idiv   %r13d
cmp    %r15d,%edx
je     13e0 <main+0x210>
mov    %edx,%r12d
mov    %r14,%rdi
mov    %edx,%esi
mov    %r15d,%edx
call   10e0 <swap@plt>
mov    %r14,%rdi
mov    %r13d,%esi
call   1090 <dist@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   10f0 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mov    0x2ba9(%rip),%rax
xorps  %xmm0,%xmm0
cvtsi2sdq (%rax),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x50(%rsp)
movsd  (%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <boltz@plt>
movsd  0x50(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm1
jbe    148d <main+0x2bd>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
call   10e0 <swap@plt>
mov    %r14,%rdi
mov    %r13d,%esi
call   1090 <dist@plt>
movapd %xmm0,%xmm1
mov    %ebx,%r12d
mov    %ebx,%eax
cltd
idivl  0x1c(%rsp)
test   %edx,%edx
lea    0xbc1(%rip),%rbx
mov    0x48(%rsp),%r15
jne    13a6 <main+0x1d6>
movsd  %xmm1,0x10(%rsp)
cvttsd2si %xmm1,%esi
lea    0xba1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13d,%r13d
jle    1380 <main+0x1b0>
xor    %ebp,%ebp
xchg   %ax,%ax
mov    (%r14,%rbp,4),%esi
mov    0x4(%r14,%rbp,4),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%rbp
cmp    %r15,%rbp
jl     14d0 <main+0x300>
jmp    1380 <main+0x1b0>
mov    $0x1,%ebx
xor    %eax,%eax
call   10d0 <print_usage@plt>
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
jmp    14fd <main+0x32d>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [13 x i8] c"n:w:h:i:f:t:\00"
@optarg = global i32 0
@RAND_MAX = global i64 0
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [7 x i8] c"%d %d \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 13
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (...) @print_usage()
store i32 0, i32* %3
br label %212
24: ; preds = %2
store i64 0, i64* @opterr
br label %25
25: ; preds = %52, %24
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @getopt(i32 %26, i8** %27, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 %28, i32* %6
%29 = icmp ne i32 %28, -1
br i1 %29, label %30, label %53
30: ; preds = %25
%31 = load i32, i32* %6
switch i32 %31, label %50 [
i32 110, label %32
i32 119, label %35
i32 104, label %38
i32 105, label %41
i32 102, label %44
i32 116, label %47
]
32: ; preds = %30
%33 = load i32, i32* @optarg
%34 = call i32 @atoi(i32 %33)
store i32 %34, i32* %7
br label %52
35: ; preds = %30
%36 = load i32, i32* @optarg
%37 = call i32 @atoi(i32 %36)
store i32 %37, i32* %8
br label %52
38: ; preds = %30
%39 = load i32, i32* @optarg
%40 = call i32 @atoi(i32 %39)
store i32 %40, i32* %9
br label %52
41: ; preds = %30
%42 = load i32, i32* @optarg
%43 = call double @atof(i32 %42)
store double %43, double* %10
br label %52
44: ; preds = %30
%45 = load i32, i32* @optarg
%46 = call double @atof(i32 %45)
store double %46, double* %11
br label %52
47: ; preds = %30
%48 = load i32, i32* @optarg
%49 = call double @atof(i32 %48)
store double %49, double* %12
br label %52
50: ; preds = %30
%51 = call i32 (...) @print_usage()
store i32 1, i32* %3
br label %212
52: ; preds = %47, %44, %41, %38, %35, %32
br label %25
53: ; preds = %25
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
%56 = mul nsw i32 2, %55
%57 = sext i32 %56 to i64
%58 = mul i64 %57, 4
%59 = trunc i64 %58 to i32
%60 = call i32* @malloc(i32 %59)
store i32* %60, i32** %15
%61 = call i32 @time(i32* null)
%62 = call i32 @srand(i32 %61)
store i32 0, i32* %13
br label %63
63: ; preds = %84, %53
%64 = load i32, i32* %13
%65 = load i32, i32* %7
%66 = mul nsw i32 2, %65
%67 = icmp slt i32 %64, %66
br i1 %67, label %68, label %87
68: ; preds = %63
%69 = call i32 (...) @rand()
%70 = load i32, i32* %8
%71 = srem i32 %69, %70
%72 = load i32*, i32** %15
%73 = load i32, i32* %13
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %72, i64 %74
store i32 %71, i32* %75
%76 = call i32 (...) @rand()
%77 = load i32, i32* %9
%78 = srem i32 %76, %77
%79 = load i32*, i32** %15
%80 = load i32, i32* %13
%81 = add nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %79, i64 %82
store i32 %78, i32* %83
br label %84
84: ; preds = %68
%85 = load i32, i32* %13
%86 = add nsw i32 %85, 2
store i32 %86, i32* %13
br label %63
87: ; preds = %63
%88 = load i32*, i32** %15
%89 = getelementptr inbounds i32, i32* %88, i64 0
%90 = load i32, i32* %89
%91 = load i32*, i32** %15
%92 = load i32, i32* %7
%93 = mul nsw i32 2, %92
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %91, i64 %94
store i32 %90, i32* %95
%96 = load i32*, i32** %15
%97 = getelementptr inbounds i32, i32* %96, i64 1
%98 = load i32, i32* %97
%99 = load i32*, i32** %15
%100 = load i32, i32* %7
%101 = mul nsw i32 2, %100
%102 = add nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32, i32* %99, i64 %103
store i32 %98, i32* %104
store i32 0, i32* %16
%105 = load i32*, i32** %15
%106 = load i32, i32* %7
%107 = call double @dist(i32* %105, i32 %106)
store double %107, double* %17
%108 = load double, double* %11
store double %108, double* %19
br label %109
109: ; preds = %210, %87
%110 = load double, double* %19
%111 = load double, double* %10
%112 = fcmp ogt double %110, %111
br i1 %112, label %113, label %211
113: ; preds = %109
%114 = load i32, i32* %16
%115 = add nsw i32 %114, 1
store i32 %115, i32* %16
%116 = load i32, i32* %16
%117 = load double, double* %11
%118 = load double, double* %12
%119 = call double @cooling(i32 %116, double %117, double %118)
store double %119, double* %19
%120 = load double, double* %17
store double %120, double* %18
%121 = call i32 (...) @rand()
%122 = load i32, i32* %7
%123 = srem i32 %121, %122
store i32 %123, i32* %13
%124 = call i32 (...) @rand()
%125 = load i32, i32* %7
%126 = srem i32 %124, %125
store i32 %126, i32* %14
br label %127
127: ; preds = %131, %113
%128 = load i32, i32* %13
%129 = load i32, i32* %14
%130 = icmp eq i32 %128, %129
br i1 %130, label %131, label %138
131: ; preds = %127
%132 = call i32 (...) @rand()
%133 = load i32, i32* %7
%134 = srem i32 %132, %133
store i32 %134, i32* %13
%135 = call i32 (...) @rand()
%136 = load i32, i32* %7
%137 = srem i32 %135, %136
store i32 %137, i32* %14
br label %127
138: ; preds = %127
%139 = load i32*, i32** %15
%140 = load i32, i32* %13
%141 = load i32, i32* %14
%142 = call i32 @swap(i32* %139, i32 %140, i32 %141)
%143 = load i32*, i32** %15
%144 = load i32, i32* %7
%145 = call double @dist(i32* %143, i32 %144)
store double %145, double* %17
%146 = call i32 (...) @rand()
%147 = sitofp i32 %146 to double
%148 = load i64, i64* @RAND_MAX
%149 = sitofp i64 %148 to double
%150 = fdiv double %147, %149
%151 = load double, double* %17
%152 = load double, double* %18
%153 = fsub double %151, %152
%154 = load double, double* %19
%155 = call double @boltz(double %153, double %154)
%156 = fcmp ogt double %150, %155
br i1 %156, label %157, label %165
157: ; preds = %138
%158 = load i32*, i32** %15
%159 = load i32, i32* %13
%160 = load i32, i32* %14
%161 = call i32 @swap(i32* %158, i32 %159, i32 %160)
%162 = load i32*, i32** %15
%163 = load i32, i32* %7
%164 = call double @dist(i32* %162, i32 %163)
store double %164, double* %17
br label %165
165: ; preds = %157, %138
%166 = load i32, i32* %16
%167 = load double, double* %12
%168 = fdiv double %167, 1.000000e+01
%169 = fptosi double %168 to i32
%170 = srem i32 %166, %169
%171 = icmp eq i32 %170, 0
br i1 %171, label %172, label %210
172: ; preds = %165
%173 = load double, double* %17
%174 = fptosi double %173 to i32
%175 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %174)
store i32 0, i32* %13
br label %176
176: ; preds = %194, %172
%177 = load i32, i32* %13
%178 = load i32, i32* %7
%179 = mul nsw i32 2, %178
%180 = icmp slt i32 %177, %179
br i1 %180, label %181, label %197
181: ; preds = %176
%182 = load i32*, i32** %15
%183 = load i32, i32* %13
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds i32, i32* %182, i64 %184
%186 = load i32, i32* %185
%187 = load i32*, i32** %15
%188 = load i32, i32* %13
%189 = add nsw i32 %188, 1
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i32, i32* %187, i64 %190
%192 = load i32, i32* %191
%193 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %186, i32 %192)
br label %194
194: ; preds = %181
%195 = load i32, i32* %13
%196 = add nsw i32 %195, 2
store i32 %196, i32* %13
br label %176
197: ; preds = %176
%198 = load i32*, i32** %15
%199 = load i32, i32* %7
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds i32, i32* %198, i64 %200
%202 = load i32, i32* %201
%203 = load i32*, i32** %15
%204 = load i32, i32* %7
%205 = add nsw i32 %204, 1
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds i32, i32* %203, i64 %206
%208 = load i32, i32* %207
%209 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %202, i32 %208)
br label %210
210: ; preds = %197, %165
br label %109
211: ; preds = %109
store i32 0, i32* %3
br label %212
212: ; preds = %211, %50, %22
%213 = load i32, i32* %3
ret i32 %213
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [13 x i8] c"n:w:h:i:f:t:\00"
@optarg = global i32 0
@RAND_MAX = global i64 0
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [7 x i8] c"%d %d \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 13
br i1 %3, label %143, label %4
4: ; preds = %2
store i64 0, i64* @opterr
br label %5
5: ; preds = %36, %4
%6 = phi i32 [ %38, %36 ], [ undef, %4 ]
%7 = phi i32 [ %13, %36 ], [ undef, %4 ]
%8 = phi double [ %19, %36 ], [ undef, %4 ]
%9 = phi double [ %24, %36 ], [ undef, %4 ]
%10 = phi double [ %28, %36 ], [ undef, %4 ]
%11 = phi i32 [ %31, %36 ], [ undef, %4 ]
br label %12
12: ; preds = %5, %39
%13 = phi i32 [ %7, %5 ], [ %41, %39 ]
%14 = phi double [ %8, %5 ], [ %19, %39 ]
%15 = phi double [ %9, %5 ], [ %24, %39 ]
%16 = phi double [ %10, %5 ], [ %28, %39 ]
%17 = phi i32 [ %11, %5 ], [ %31, %39 ]
br label %18
18: ; preds = %12, %42
%19 = phi double [ %14, %12 ], [ %44, %42 ]
%20 = phi double [ %15, %12 ], [ %24, %42 ]
%21 = phi double [ %16, %12 ], [ %28, %42 ]
%22 = phi i32 [ %17, %12 ], [ %31, %42 ]
br label %23
23: ; preds = %18, %45
%24 = phi double [ %20, %18 ], [ %47, %45 ]
%25 = phi double [ %21, %18 ], [ %28, %45 ]
%26 = phi i32 [ %22, %18 ], [ %31, %45 ]
br label %27
27: ; preds = %23, %48
%28 = phi double [ %25, %23 ], [ %50, %48 ]
%29 = phi i32 [ %26, %23 ], [ %31, %48 ]
br label %30
30: ; preds = %27, %33
%31 = phi i32 [ %35, %33 ], [ %29, %27 ]
%32 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
switch i32 %32, label %143 [
i32 -1, label %51
i32 110, label %33
i32 119, label %36
i32 104, label %39
i32 105, label %42
i32 102, label %45
i32 116, label %48
]
33: ; preds = %30
%34 = load i32, i32* @optarg
%35 = tail call i32 @atoi(i32 %34)
br label %30
36: ; preds = %30
%37 = load i32, i32* @optarg
%38 = tail call i32 @atoi(i32 %37)
br label %5
39: ; preds = %30
%40 = load i32, i32* @optarg
%41 = tail call i32 @atoi(i32 %40)
br label %12
42: ; preds = %30
%43 = load i32, i32* @optarg
%44 = tail call double @atof(i32 %43)
br label %18
45: ; preds = %30
%46 = load i32, i32* @optarg
%47 = tail call double @atof(i32 %46)
br label %23
48: ; preds = %30
%49 = load i32, i32* @optarg
%50 = tail call double @atof(i32 %49)
br label %27
51: ; preds = %30
%52 = add nsw i32 %31, 1
%53 = shl i32 %52, 3
%54 = tail call i32* @malloc(i32 %53)
%55 = tail call i32 @time(i32* null)
%56 = tail call i32 @srand(i32 %55)
%57 = shl nsw i32 %31, 1
%58 = icmp sgt i32 %31, 0
%59 = sext i32 %57 to i64
br i1 %58, label %60, label %71
60: ; preds = %51, %60
%61 = phi i64 [ %69, %60 ], [ 0, %51 ]
%62 = tail call i32 (...) @rand()
%63 = srem i32 %62, %6
%64 = getelementptr inbounds i32, i32* %54, i64 %61
store i32 %63, i32* %64
%65 = tail call i32 (...) @rand()
%66 = srem i32 %65, %13
%67 = or i64 %61, 1
%68 = getelementptr inbounds i32, i32* %54, i64 %67
store i32 %66, i32* %68
%69 = add nuw nsw i64 %61, 2
%70 = icmp slt i64 %69, %59
br i1 %70, label %60, label %71
71: ; preds = %60, %51
%72 = load i32, i32* %54
%73 = getelementptr inbounds i32, i32* %54, i64 %59
store i32 %72, i32* %73
%74 = getelementptr inbounds i32, i32* %54, i64 1
%75 = load i32, i32* %74
%76 = or i32 %57, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %54, i64 %77
store i32 %75, i32* %78
%79 = tail call double @dist(i32* %54, i32 %31)
%80 = fcmp ogt double %24, %19
br i1 %80, label %81, label %146
81: ; preds = %71
%82 = fdiv double %28, 1.000000e+01
%83 = fptosi double %82 to i32
%84 = sext i32 %31 to i64
%85 = getelementptr inbounds i32, i32* %54, i64 %84
%86 = sext i32 %52 to i64
%87 = getelementptr inbounds i32, i32* %54, i64 %86
br label %88
88: ; preds = %81, %141
%89 = phi double [ %79, %81 ], [ %121, %141 ]
%90 = phi i32 [ 0, %81 ], [ %91, %141 ]
%91 = add nuw nsw i32 %90, 1
%92 = tail call double @cooling(i32 %91, double %24, double %28)
%93 = tail call i32 (...) @rand()
%94 = tail call i32 (...) @rand()
%95 = srem i32 %94, %31
%96 = srem i32 %93, %31
%97 = icmp eq i32 %96, %95
br i1 %97, label %98, label %104
98: ; preds = %88, %98
%99 = tail call i32 (...) @rand()
%100 = tail call i32 (...) @rand()
%101 = srem i32 %100, %31
%102 = srem i32 %99, %31
%103 = icmp eq i32 %102, %101
br i1 %103, label %98, label %104
104: ; preds = %98, %88
%105 = phi i32 [ %95, %88 ], [ %101, %98 ]
%106 = phi i32 [ %96, %88 ], [ %102, %98 ]
%107 = tail call i32 @swap(i32* %54, i32 %106, i32 %105)
%108 = tail call double @dist(i32* %54, i32 %31)
%109 = tail call i32 (...) @rand()
%110 = sitofp i32 %109 to double
%111 = load i64, i64* @RAND_MAX
%112 = sitofp i64 %111 to double
%113 = fdiv double %110, %112
%114 = fsub double %108, %89
%115 = tail call double @boltz(double %114, double %92)
%116 = fcmp ogt double %113, %115
br i1 %116, label %117, label %120
117: ; preds = %104
%118 = tail call i32 @swap(i32* %54, i32 %106, i32 %105)
%119 = tail call double @dist(i32* %54, i32 %31)
br label %120
120: ; preds = %117, %104
%121 = phi double [ %119, %117 ], [ %108, %104 ]
%122 = srem i32 %91, %83
%123 = icmp eq i32 %122, 0
br i1 %123, label %124, label %141
124: ; preds = %120
%125 = fptosi double %121 to i32
%126 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %125)
br i1 %58, label %127, label %137
127: ; preds = %124, %127
%128 = phi i64 [ %135, %127 ], [ 0, %124 ]
%129 = getelementptr inbounds i32, i32* %54, i64 %128
%130 = load i32, i32* %129
%131 = or i64 %128, 1
%132 = getelementptr inbounds i32, i32* %54, i64 %131
%133 = load i32, i32* %132
%134 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %130, i32 %133)
%135 = add nuw nsw i64 %128, 2
%136 = icmp slt i64 %135, %59
br i1 %136, label %127, label %137
137: ; preds = %127, %124
%138 = load i32, i32* %85
%139 = load i32, i32* %87
%140 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %138, i32 %139)
br label %141
141: ; preds = %137, %120
%142 = fcmp ogt double %92, %19
br i1 %142, label %88, label %146
143: ; preds = %30, %2
%144 = phi i32 [ 0, %2 ], [ 1, %30 ]
%145 = tail call i32 (...) @print_usage()
br label %146
146: ; preds = %141, %143, %71
%147 = phi i32 [ 0, %71 ], [ %144, %143 ], [ 0, %141 ]
ret i32 %147
}