#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 dist(double, double, double, double);
int /*<<< orphan*/ printf(char *, double, double, ...);
double random_number(int /*<<< orphan*/, int);
int main() {
  for (int i = 0; i++; i < 10) {
    double val1 = random_number(0, 180);
    double val2 = random_number(0, 180);
    double val3 = random_number(0, 180);
    double val4 = random_number(0, 180);
    double d = dist(val1, val2, val3, val4);
    printf("val1: %lf, val2: %lf, val3: %lf, val4: %lf", val1, val2, val3,
           val4);
    printf("dist: %.1f km (%.1f mi.)\n", d, d / 1.609344);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1207 <main+0xd7>
xor    %edi,%edi
mov    $0xb4,%esi
call   1040 <random_number@plt>
movsd  %xmm0,-0x10(%rbp)
xor    %edi,%edi
mov    $0xb4,%esi
call   1040 <random_number@plt>
movsd  %xmm0,-0x18(%rbp)
xor    %edi,%edi
mov    $0xb4,%esi
call   1040 <random_number@plt>
movsd  %xmm0,-0x20(%rbp)
xor    %edi,%edi
mov    $0xb4,%esi
call   1040 <random_number@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   1050 <dist@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
lea    0xe31(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xe10(%rip),%xmm2
divsd  %xmm2,%xmm1
lea    0xe38(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [43 x i8] c"val1: %lf, val2: %lf, val3: %lf, val4: %lf\00"
@.str.1 = [26 x i8] c"dist: %.1f km (%.1f mi.)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %35
12: ; preds = %8
%13 = call double @random_number(i32 0, i32 180)
store double %13, double* %3
%14 = call double @random_number(i32 0, i32 180)
store double %14, double* %4
%15 = call double @random_number(i32 0, i32 180)
store double %15, double* %5
%16 = call double @random_number(i32 0, i32 180)
store double %16, double* %6
%17 = load double, double* %3
%18 = load double, double* %4
%19 = load double, double* %5
%20 = load double, double* %6
%21 = call double @dist(double %17, double %18, double %19, double %20)
store double %21, double* %7
%22 = load double, double* %3
%23 = load double, double* %4
%24 = load double, double* %5
%25 = load double, double* %6
%26 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), double %22, double %23, double %24, double %25)
%27 = load double, double* %7
%28 = load double, double* %7
%29 = fdiv double %28, 0x3FF9BFDF7E8038A0
%30 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double %27, double %29)
br label %31
31: ; preds = %12
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 10
%34 = zext i1 %33 to i32
br label %8
35: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}