#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*/ assert(int);
float get_population(float latitude, float longitude, float **populations) {
  float delta = 0.0083333333333;
  float long_min = -181.0;
  float lat_min = 7.0;
  int N_lat = 9240;
  int N_long = 20520;
  int lat_idx = (latitude - lat_min) / delta;
  int long_idx = (longitude - long_min) / delta;
  assert(lat_idx >= 0 && lat_idx < N_lat);
  assert(long_idx >= 0 && long_idx < N_long);
  return populations[lat_idx][long_idx];
}


x86 assembly (clang, -O0):
<get_population>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xeb8(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x2418,-0x20(%rbp)
movl   $0x5028,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x28(%rbp)
mov    %al,-0x2d(%rbp)
jl     11a2 <get_population+0x92>
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
setl   %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x2e(%rbp)
jl     11ca <get_population+0xba>
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
setl   %al
mov    %al,-0x2e(%rbp)
mov    -0x2e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_population>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
unpcklps %xmm0,%xmm1
addps  0xee0(%rip),%xmm1
mov    %rdi,%rbx
divps  0xee6(%rip),%xmm1
cvttps2dq %xmm1,%xmm1
movdqa %xmm1,(%rsp)
movdqa 0xee5(%rip),%xmm0
pxor   %xmm1,%xmm0
movdqa 0xee9(%rip),%xmm1
pcmpgtd %xmm0,%xmm1
pshufd $0x50,%xmm1,%xmm0
movmskpd %xmm0,%ebp
mov    %ebp,%eax
shr    %al
movzbl %al,%edi
call   1030 <assert@plt>
and    $0x1,%ebp
mov    %ebp,%edi
call   1030 <assert@plt>
movdqa (%rsp),%xmm1
pshufd $0x55,%xmm1,%xmm0
movd   %xmm0,%eax
cltq
mov    (%rbx,%rax,8),%rax
movd   %xmm1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @get_population(float %0, float %1, float** %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float**
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store float %0, float* %4
store float %1, float* %5
store float** %2, float*** %6
store float 0x3F81111120000000, float* %7
store float -1.810000e+02, float* %8
store float 7.000000e+00, float* %9
store i32 9240, i32* %10
store i32 20520, i32* %11
%14 = load float, float* %4
%15 = load float, float* %9
%16 = fsub float %14, %15
%17 = load float, float* %7
%18 = fdiv float %16, %17
%19 = fptosi float %18 to i32
store i32 %19, i32* %12
%20 = load float, float* %5
%21 = load float, float* %8
%22 = fsub float %20, %21
%23 = load float, float* %7
%24 = fdiv float %22, %23
%25 = fptosi float %24 to i32
store i32 %25, i32* %13
%26 = load i32, i32* %12
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %3
%29 = load i32, i32* %12
%30 = load i32, i32* %10
%31 = icmp slt i32 %29, %30
br label %32
32: ; preds = %28, %3
%33 = phi i1 [ false, %3 ], [ %31, %28 ]
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %13
%37 = icmp sge i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = load i32, i32* %13
%40 = load i32, i32* %11
%41 = icmp slt i32 %39, %40
br label %42
42: ; preds = %38, %32
%43 = phi i1 [ false, %32 ], [ %41, %38 ]
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load float**, float*** %6
%47 = load i32, i32* %12
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds float*, float** %46, i64 %48
%50 = load float*, float** %49
%51 = load i32, i32* %13
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds float, float* %50, i64 %52
%54 = load float, float* %53
ret float %54
}

LLVM IR (-O2):
define float @get_population(float %0, float %1, float** nocapture %2) {
%4 = insertelement <2 x float> poison, float %1, i64 0
%5 = insertelement <2 x float> %4, float %0, i64 1
%6 = fadd <2 x float> %5, <float 1.810000e+02, float -7.000000e+00>
%7 = fdiv <2 x float> %6, <float 0x3F81111120000000, float 0x3F81111120000000>
%8 = fptosi <2 x float> %7 to <2 x i32>
%9 = icmp ult <2 x i32> %8, <i32 20520, i32 9240>
%10 = extractelement <2 x i1> %9, i64 1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = extractelement <2 x i1> %9, i64 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = extractelement <2 x i32> %8, i64 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float*, float** %2, i64 %17
%19 = load float*, float** %18
%20 = extractelement <2 x i32> %8, i64 0
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %19, i64 %21
%23 = load float, float* %22
ret float %23
}