#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 M_PI;
scalar_t__ RAND_MAX;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, int, int, int, ...);
double rand();
double sin(double);
int main() {
  const int sampleCount = 6 * 60 * 24;
  const int samplesPerOrbit = 6 * 90;
  const int samplesPerTimeslice = 60;
  const int timeSlices = 6 * 24 + 1;
  const int heightLevels = 57;
  const int latitudes = 72;
  const int longitudes = 144;
  for (int sample = 0; sample < sampleCount; sample++) {
    double longitude = sample % samplesPerOrbit / (double)samplesPerOrbit;
    double latitude = 0.5 + 0.4 * sin(longitude * 2 * M_PI);
    double time = sample / (double)((timeSlices - 1) * samplesPerTimeslice);
    double height = rand() / (double)RAND_MAX;
    int t = time * (timeSlices - 1);
    int h = height * (heightLevels - 1);
    int lat = latitude * (latitudes - 1);
    int lon1 = longitude * longitudes;
    int lon2 = (lon1 + 1) % longitudes;
    assert(0 <= t && t < timeSlices - 1);
    assert(0 <= h && h < heightLevels - 1);
    assert(0 <= lat && lat < latitudes - 1);
    assert(0 <= lon1 && lon1 < longitudes);
    assert(0 <= lon2 && lon2 < longitudes);
    printf("var1(4): (%d,0,%d,%d) (2,57,2,1) (2,57,2,1)\n", t, lat, lon1);
    printf("var1(4): (%d,0,%d,%d) (2,57,2,1) (2,57,2,1)\n", t, lat, lon2);
    printf("var2(4): (%d,%d,%d,%d) (2,2,2,1) (2,2,2,1)\n", t, h, lat, lon1);
    printf("var2(4): (%d,%d,%d,%d) (2,2,2,1) (2,2,2,1)\n", t, h, lat, lon2);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x21c0,-0x8(%rbp)
movl   $0x21c,-0xc(%rbp)
movl   $0x3c,-0x10(%rbp)
movl   $0x91,-0x14(%rbp)
movl   $0x39,-0x18(%rbp)
movl   $0x48,-0x1c(%rbp)
movl   $0x90,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x21c0,-0x24(%rbp)
jge    13bf <main+0x27f>
mov    -0x24(%rbp),%eax
mov    $0x21c,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  0xe8d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe74(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    0x2e20(%rip),%rax
mulsd  (%rax),%xmm0
call   1050 <sin@plt>
movsd  0xe47(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe43(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    0x2dce(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xdd8(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
movsd  0xdd4(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x50(%rbp)
movsd  0xdb8(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
movsd  0xd9c(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    $0x90,%ecx
cltd
idiv   %ecx
mov    %edx,-0x5c(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x4c(%rbp),%ecx
mov    %al,-0x5d(%rbp)
jg     129e <main+0x15e>
cmpl   $0x90,-0x4c(%rbp)
setl   %al
mov    %al,-0x5d(%rbp)
mov    -0x5d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x50(%rbp),%ecx
mov    %al,-0x5e(%rbp)
jg     12c5 <main+0x185>
cmpl   $0x38,-0x50(%rbp)
setl   %al
mov    %al,-0x5e(%rbp)
mov    -0x5e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x54(%rbp),%ecx
mov    %al,-0x5f(%rbp)
jg     12ec <main+0x1ac>
cmpl   $0x47,-0x54(%rbp)
setl   %al
mov    %al,-0x5f(%rbp)
mov    -0x5f(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x58(%rbp),%ecx
mov    %al,-0x60(%rbp)
jg     1316 <main+0x1d6>
cmpl   $0x90,-0x58(%rbp)
setl   %al
mov    %al,-0x60(%rbp)
mov    -0x60(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x5c(%rbp),%ecx
mov    %al,-0x61(%rbp)
jg     1340 <main+0x200>
cmpl   $0x90,-0x5c(%rbp)
setl   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4c(%rbp),%esi
mov    -0x54(%rbp),%edx
mov    -0x58(%rbp),%ecx
lea    0xce3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%esi
mov    -0x54(%rbp),%edx
mov    -0x5c(%rbp),%ecx
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x58(%rbp),%r8d
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x5c(%rbp),%r8d
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1187 <main+0x47>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x21c0,%eax
xor    %ecx,%ecx
nop
mov    %rcx,0x20(%rsp)
mov    %eax,0x1c(%rsp)
movzwl %cx,%eax
imul   $0x795d,%eax,%eax
shr    $0x18,%eax
imul   $0x21c,%eax,%eax
mov    0x20(%rsp),%rcx
sub    %eax,%ecx
movzwl %cx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe6c(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
addsd  %xmm0,%xmm0
mov    0x2e43(%rip),%rax
mulsd  (%rax),%xmm0
call   1050 <sin@plt>
mulsd  0xe52(%rip),%xmm0
addsd  0xe52(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0xe46(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
mov    0x2dfa(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xe2d(%rip),%xmm2
movsd  0x8(%rsp),%xmm3
mulsd  %xmm2,%xmm3
cvttsd2si %xmm3,%r13d
divsd  %xmm1,%xmm0
mulsd  0xe1a(%rip),%xmm0
cvttsd2si %xmm0,%r15d
mov    %r15d,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  0xe0a(%rip),%xmm0
cvttsd2si %xmm0,%ebx
movsd  0x30(%rsp),%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%ebp
lea    0x1(%rbp),%eax
cltq
imul   $0x38e38e39,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
shl    $0x4,%eax
lea    (%rax,%rax,8),%eax
neg    %eax
lea    (%rax,%rbp,1),%r14d
add    $0x1,%r14d
xor    %edi,%edi
cmp    $0x90,%r13d
setb   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x38,%r15d
setb   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x47,%ebx
setb   %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x90,%ebp
setb   %dil
call   1040 <assert@plt>
mov    %r14d,%edi
not    %edi
shr    $0x1f,%edi
call   1040 <assert@plt>
lea    0xd8b(%rip),%r12
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
mov    %r14d,%r15d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd8b(%rip),%r12
mov    %r12,%rdi
mov    %r13d,%esi
mov    0x8(%rsp),%r14d
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%rcx
mov    0x1c(%rsp),%eax
movsd  0x10(%rsp),%xmm0
addsd  0xd10(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0x1,%ecx
add    $0xffffffff,%eax
jne    1160 <main+0x20>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@RAND_MAX = global i64 0
@.str = [45 x i8] c"var1(4): (%d,0,%d,%d) (2,57,2,1) (2,57,2,1)\0A\00"
@.str.1 = [44 x i8] c"var2(4): (%d,%d,%d,%d) (2,2,2,1) (2,2,2,1)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %1
store i32 8640, i32* %2
store i32 540, i32* %3
store i32 60, i32* %4
store i32 145, i32* %5
store i32 57, i32* %6
store i32 72, i32* %7
store i32 144, i32* %8
store i32 0, i32* %9
br label %19
19: ; preds = %118, %0
%20 = load i32, i32* %9
%21 = icmp slt i32 %20, 8640
br i1 %21, label %22, label %121
22: ; preds = %19
%23 = load i32, i32* %9
%24 = srem i32 %23, 540
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, 5.400000e+02
store double %26, double* %10
%27 = load double, double* %10
%28 = fmul double %27, 2.000000e+00
%29 = load double, double* @M_PI
%30 = fmul double %28, %29
%31 = call double @sin(double %30)
%32 = call double @llvm.fmuladd.f64(double 4.000000e-01, double %31, double 5.000000e-01)
store double %32, double* %11
%33 = load i32, i32* %9
%34 = sitofp i32 %33 to double
%35 = fdiv double %34, 8.640000e+03
store double %35, double* %12
%36 = call double (...) @rand()
%37 = load i64, i64* @RAND_MAX
%38 = sitofp i64 %37 to double
%39 = fdiv double %36, %38
store double %39, double* %13
%40 = load double, double* %12
%41 = fmul double %40, 1.440000e+02
%42 = fptosi double %41 to i32
store i32 %42, i32* %14
%43 = load double, double* %13
%44 = fmul double %43, 5.600000e+01
%45 = fptosi double %44 to i32
store i32 %45, i32* %15
%46 = load double, double* %11
%47 = fmul double %46, 7.100000e+01
%48 = fptosi double %47 to i32
store i32 %48, i32* %16
%49 = load double, double* %10
%50 = fmul double %49, 1.440000e+02
%51 = fptosi double %50 to i32
store i32 %51, i32* %17
%52 = load i32, i32* %17
%53 = add nsw i32 %52, 1
%54 = srem i32 %53, 144
store i32 %54, i32* %18
%55 = load i32, i32* %14
%56 = icmp sle i32 0, %55
br i1 %56, label %57, label %60
57: ; preds = %22
%58 = load i32, i32* %14
%59 = icmp slt i32 %58, 144
br label %60
60: ; preds = %57, %22
%61 = phi i1 [ false, %22 ], [ %59, %57 ]
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = load i32, i32* %15
%65 = icmp sle i32 0, %64
br i1 %65, label %66, label %69
66: ; preds = %60
%67 = load i32, i32* %15
%68 = icmp slt i32 %67, 56
br label %69
69: ; preds = %66, %60
%70 = phi i1 [ false, %60 ], [ %68, %66 ]
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = load i32, i32* %16
%74 = icmp sle i32 0, %73
br i1 %74, label %75, label %78
75: ; preds = %69
%76 = load i32, i32* %16
%77 = icmp slt i32 %76, 71
br label %78
78: ; preds = %75, %69
%79 = phi i1 [ false, %69 ], [ %77, %75 ]
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = load i32, i32* %17
%83 = icmp sle i32 0, %82
br i1 %83, label %84, label %87
84: ; preds = %78
%85 = load i32, i32* %17
%86 = icmp slt i32 %85, 144
br label %87
87: ; preds = %84, %78
%88 = phi i1 [ false, %78 ], [ %86, %84 ]
%89 = zext i1 %88 to i32
%90 = call i32 @assert(i32 %89)
%91 = load i32, i32* %18
%92 = icmp sle i32 0, %91
br i1 %92, label %93, label %96
93: ; preds = %87
%94 = load i32, i32* %18
%95 = icmp slt i32 %94, 144
br label %96
96: ; preds = %93, %87
%97 = phi i1 [ false, %87 ], [ %95, %93 ]
%98 = zext i1 %97 to i32
%99 = call i32 @assert(i32 %98)
%100 = load i32, i32* %14
%101 = load i32, i32* %16
%102 = load i32, i32* %17
%103 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %100, i32 %101, i32 %102)
%104 = load i32, i32* %14
%105 = load i32, i32* %16
%106 = load i32, i32* %18
%107 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %104, i32 %105, i32 %106)
%108 = load i32, i32* %14
%109 = load i32, i32* %15
%110 = load i32, i32* %16
%111 = load i32, i32* %17
%112 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %108, i32 %109, i32 %110, i32 %111)
%113 = load i32, i32* %14
%114 = load i32, i32* %15
%115 = load i32, i32* %16
%116 = load i32, i32* %18
%117 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %113, i32 %114, i32 %115, i32 %116)
br label %118
118: ; preds = %96
%119 = load i32, i32* %9
%120 = add nsw i32 %119, 1
store i32 %120, i32* %9
br label %19
121: ; preds = %19
%122 = load i32, i32* %1
ret i32 %122
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@RAND_MAX = global i64 0
@.str = [45 x i8] c"var1(4): (%d,0,%d,%d) (2,57,2,1) (2,57,2,1)\0A\00"
@.str.1 = [44 x i8] c"var2(4): (%d,%d,%d,%d) (2,2,2,1) (2,2,2,1)\0A\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %48, %2 ]
%4 = trunc i32 %3 to i16
%5 = urem i16 %4, 540
%6 = uitofp i16 %5 to double
%7 = fdiv double %6, 5.400000e+02
%8 = fmul double %7, 2.000000e+00
%9 = load double, double* @M_PI
%10 = fmul double %8, %9
%11 = tail call double @sin(double %10)
%12 = tail call double @llvm.fmuladd.f64(double %11, double 4.000000e-01, double 5.000000e-01)
%13 = sitofp i32 %3 to double
%14 = fdiv double %13, 8.640000e+03
%15 = tail call double (...) @rand()
%16 = load i64, i64* @RAND_MAX
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = fmul double %14, 1.440000e+02
%20 = fptosi double %19 to i32
%21 = fmul double %18, 5.600000e+01
%22 = fptosi double %21 to i32
%23 = fmul double %12, 7.100000e+01
%24 = fptosi double %23 to i32
%25 = fmul double %7, 1.440000e+02
%26 = fptosi double %25 to i32
%27 = add nsw i32 %26, 1
%28 = srem i32 %27, 144
%29 = icmp ult i32 %20, 144
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = icmp ult i32 %22, 56
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = icmp ult i32 %24, 71
%36 = zext i1 %35 to i32
%37 = tail call i32 @assert(i32 %36)
%38 = icmp ult i32 %26, 144
%39 = zext i1 %38 to i32
%40 = tail call i32 @assert(i32 %39)
%41 = xor i32 %28, -1
%42 = lshr i32 %41, 31
%43 = tail call i32 @assert(i32 %42)
%44 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %24, i32 %26)
%45 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %24, i32 %28)
%46 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %22, i32 %24, i32 %26)
%47 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %22, i32 %24, i32 %28)
%48 = add nuw nsw i32 %3, 1
%49 = icmp eq i32 %48, 8640
br i1 %49, label %1, label %2
}