void init_partial_coastline(double minlat, double minlong, double maxlat,
                            double maxlong) {
  int iminlat, imaxlat, iminlong, imaxlong;
  minlong = fmod(minlong, 3.14159265358979323846 * 2);
  maxlong = fmod(maxlong, 3.14159265358979323846 * 2);
  if (minlong < 0) {
    minlong += 3.14159265358979323846 * 2;
  }
  if (maxlong < 0) {
    maxlong += 3.14159265358979323846 * 2;
  }
  iminlat =
      (int)floor(10.0 * (((minlat)*180.0) / 3.14159265358979323846)) + 900;
  imaxlat = (int)ceil(10.0 * (((maxlat)*180.0) / 3.14159265358979323846)) + 900;
  iminlong = (int)floor(10.0 * (((minlong)*180.0) / 3.14159265358979323846));
  imaxlong = (int)ceil(10.0 * (((maxlong)*180.0) / 3.14159265358979323846));
  if (imaxlat > 1799) {
    imaxlat = 1799;
  }
  if (imaxlong > 3600) {
    imaxlong = 3600;
  }
  internal_init_partial_coastline(iminlat, iminlong, imaxlat, imaxlong);
}


x86 assembly (clang, -O0):
<init_partial_coastline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe97(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe80(%rip),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11aa <init_partial_coastline+0x6a>
movsd  0xe60(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ca <init_partial_coastline+0x8a>
movsd  0xe40(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe46(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xe31(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe1d(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <floor@plt>
cvttsd2si %xmm0,%eax
add    $0x384,%eax
mov    %eax,-0x24(%rbp)
movsd  0xe10(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xdfb(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xde7(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
add    $0x384,%eax
mov    %eax,-0x28(%rbp)
movsd  0xdda(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xdc5(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdb1(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
movsd  0xda9(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xd94(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd80(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x707,-0x28(%rbp)
jle    12ac <init_partial_coastline+0x16c>
movl   $0x707,-0x28(%rbp)
cmpl   $0xe10,-0x30(%rbp)
jle    12c0 <init_partial_coastline+0x180>
movl   $0xe10,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    $0x0,%al
call   1060 <internal_init_partial_coastline@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_partial_coastline>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
movsd  %xmm3,(%rsp)
movaps %xmm2,0x20(%rsp)
movapd %xmm1,%xmm2
movsd  %xmm0,0x30(%rsp)
movsd  0xe9e(%rip),%xmm1
movapd %xmm2,%xmm0
call   1040 <fmod@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
movsd  0xe82(%rip),%xmm1
call   1040 <fmod@plt>
movapd 0x10(%rsp),%xmm5
movapd %xmm5,%xmm1
movsd  0xe6b(%rip),%xmm4
addsd  %xmm4,%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm5,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm5,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
movapd %xmm4,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm2,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm0,%xmm1
orpd   %xmm3,%xmm1
movapd %xmm1,(%rsp)
movsd  0x30(%rsp),%xmm0
mulsd  0xe20(%rip),%xmm0
divsd  0xe20(%rip),%xmm0
mulsd  0xe20(%rip),%xmm0
call   1050 <floor@plt>
cvttsd2si %xmm0,%ebx
add    $0x384,%ebx
movapd 0x10(%rsp),%xmm0
mulsd  0xdf3(%rip),%xmm0
divsd  0xdf3(%rip),%xmm0
mulsd  0xdf3(%rip),%xmm0
call   1050 <floor@plt>
cvttsd2si %xmm0,%ebp
movapd (%rsp),%xmm0
unpcklpd 0x20(%rsp),%xmm0
mulpd  0xddf(%rip),%xmm0
divpd  0xde7(%rip),%xmm0
mulpd  0xdef(%rip),%xmm0
movapd %xmm0,(%rsp)
call   1030 <ceil@plt>
movapd %xmm0,0x20(%rsp)
movapd (%rsp),%xmm0
unpckhpd %xmm0,%xmm0
call   1030 <ceil@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm0
movdqa 0xdcb(%rip),%xmm1
pcmpgtd %xmm0,%xmm1
pshufd $0x50,%xmm1,%xmm1
movmskpd %xmm1,%eax
pshufd $0x55,%xmm0,%xmm1
movd   %xmm1,%ecx
add    $0x384,%ecx
test   $0x2,%al
mov    $0x707,%edx
cmovne %ecx,%edx
movd   %xmm0,%esi
test   $0x1,%al
mov    $0xe10,%ecx
cmovne %esi,%ecx
mov    %ebx,%edi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <internal_init_partial_coastline@plt>

LLVM IR (-O0):
define void @init_partial_coastline(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%13 = load double, double* %6
%14 = call double @fmod(double %13, double 0x401921FB54442D18)
store double %14, double* %6
%15 = load double, double* %8
%16 = call double @fmod(double %15, double 0x401921FB54442D18)
store double %16, double* %8
%17 = load double, double* %6
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load double, double* %6
%21 = fadd double %20, 0x401921FB54442D18
store double %21, double* %6
br label %22
22: ; preds = %19, %4
%23 = load double, double* %8
%24 = fcmp olt double %23, 0.000000e+00
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load double, double* %8
%27 = fadd double %26, 0x401921FB54442D18
store double %27, double* %8
br label %28
28: ; preds = %25, %22
%29 = load double, double* %5
%30 = fmul double %29, 1.800000e+02
%31 = fdiv double %30, 0x400921FB54442D18
%32 = fmul double 1.000000e+01, %31
%33 = call double @llvm.floor.f64(double %32)
%34 = fptosi double %33 to i32
%35 = add nsw i32 %34, 900
store i32 %35, i32* %9
%36 = load double, double* %7
%37 = fmul double %36, 1.800000e+02
%38 = fdiv double %37, 0x400921FB54442D18
%39 = fmul double 1.000000e+01, %38
%40 = call double @llvm.ceil.f64(double %39)
%41 = fptosi double %40 to i32
%42 = add nsw i32 %41, 900
store i32 %42, i32* %10
%43 = load double, double* %6
%44 = fmul double %43, 1.800000e+02
%45 = fdiv double %44, 0x400921FB54442D18
%46 = fmul double 1.000000e+01, %45
%47 = call double @llvm.floor.f64(double %46)
%48 = fptosi double %47 to i32
store i32 %48, i32* %11
%49 = load double, double* %8
%50 = fmul double %49, 1.800000e+02
%51 = fdiv double %50, 0x400921FB54442D18
%52 = fmul double 1.000000e+01, %51
%53 = call double @llvm.ceil.f64(double %52)
%54 = fptosi double %53 to i32
store i32 %54, i32* %12
%55 = load i32, i32* %10
%56 = icmp sgt i32 %55, 1799
br i1 %56, label %57, label %58
57: ; preds = %28
store i32 1799, i32* %10
br label %58
58: ; preds = %57, %28
%59 = load i32, i32* %12
%60 = icmp sgt i32 %59, 3600
br i1 %60, label %61, label %62
61: ; preds = %58
store i32 3600, i32* %12
br label %62
62: ; preds = %61, %58
%63 = load i32, i32* %9
%64 = load i32, i32* %11
%65 = load i32, i32* %10
%66 = load i32, i32* %12
%67 = call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @internal_init_partial_coastline to i32 (i32, i32, i32, i32, ...)*)(i32 %63, i32 %64, i32 %65, i32 %66)
ret void
}

LLVM IR (-O2):
define void @init_partial_coastline(double %0, double %1, double %2, double %3) {
%5 = tail call double @fmod(double %1, double 0x401921FB54442D18)
%6 = tail call double @fmod(double %3, double 0x401921FB54442D18)
%7 = fcmp olt double %5, 0.000000e+00
%8 = fadd double %5, 0x401921FB54442D18
%9 = select i1 %7, double %8, double %5
%10 = fcmp olt double %6, 0.000000e+00
%11 = fadd double %6, 0x401921FB54442D18
%12 = select i1 %10, double %11, double %6
%13 = fmul double %0, 1.800000e+02
%14 = fdiv double %13, 0x400921FB54442D18
%15 = fmul double %14, 1.000000e+01
%16 = tail call double @llvm.floor.f64(double %15)
%17 = fptosi double %16 to i32
%18 = add nsw i32 %17, 900
%19 = fmul double %9, 1.800000e+02
%20 = fdiv double %19, 0x400921FB54442D18
%21 = fmul double %20, 1.000000e+01
%22 = tail call double @llvm.floor.f64(double %21)
%23 = fptosi double %22 to i32
%24 = insertelement <2 x double> poison, double %2, i64 1
%25 = insertelement <2 x double> %24, double %12, i64 0
%26 = fmul <2 x double> %25, <double 1.800000e+02, double 1.800000e+02>
%27 = fdiv <2 x double> %26, <double 0x400921FB54442D18, double 0x400921FB54442D18>
%28 = fmul <2 x double> %27, <double 1.000000e+01, double 1.000000e+01>
%29 = call <2 x double> @llvm.ceil.v2f64(<2 x double> %28)
%30 = fptosi <2 x double> %29 to <2 x i32>
%31 = icmp slt <2 x i32> %30, <i32 3600, i32 899>
%32 = extractelement <2 x i1> %31, i64 1
%33 = extractelement <2 x i32> %30, i64 1
%34 = add nsw i32 %33, 900
%35 = select i1 %32, i32 %34, i32 1799
%36 = extractelement <2 x i1> %31, i64 0
%37 = extractelement <2 x i32> %30, i64 0
%38 = select i1 %36, i32 %37, i32 3600
%39 = tail call i32 (i32, i32, i32, i32, ...) bitcast (i32 (...)* @internal_init_partial_coastline to i32 (i32, i32, i32, i32, ...)*)(i32 %18, i32 %23, i32 %35, i32 %38)
ret void
}