#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 fabs(double);
double floor(double);
double getcoord(int coord) {
  int west = 1;
  double glg, deg;
  if (coord < 0)
    west = -1;
  glg = fabs((double)coord / 100);
  deg = floor(glg);
  glg = west * (deg + (glg - deg) * 100 / 60);
  return (glg);
}


x86 assembly (clang, -O0):
<getcoord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1133 <getcoord+0x23>
movl   $0xffffffff,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps 0xec5(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
movsd  0xe89(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe75(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcoord>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
cvtsi2sd %edi,%xmm0
divsd  0xedd(%rip),%xmm0
andpd  0xee5(%rip),%xmm0
movapd %xmm0,(%rsp)
call   1030 <floor@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xeba(%rip),%xmm1
divsd  0xeba(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
test   %ebx,%ebx
jns    1162 <getcoord+0x52>
xorpd  0xebe(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @getcoord(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store i32 %0, i32* %2
store i32 1, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %3
br label %9
9: ; preds = %8, %1
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 1.000000e+02
%13 = call double @llvm.fabs.f64(double %12)
store double %13, double* %4
%14 = load double, double* %4
%15 = call double @llvm.floor.f64(double %14)
store double %15, double* %5
%16 = load i32, i32* %3
%17 = sitofp i32 %16 to double
%18 = load double, double* %5
%19 = load double, double* %4
%20 = load double, double* %5
%21 = fsub double %19, %20
%22 = fmul double %21, 1.000000e+02
%23 = fdiv double %22, 6.000000e+01
%24 = fadd double %18, %23
%25 = fmul double %17, %24
store double %25, double* %4
%26 = load double, double* %4
ret double %26
}

LLVM IR (-O2):
define double @getcoord(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = sitofp i32 %0 to double
%4 = fdiv double %3, 1.000000e+02
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = tail call double @llvm.floor.f64(double %5)
%7 = fsub double %5, %6
%8 = fmul double %7, 1.000000e+02
%9 = fdiv double %8, 6.000000e+01
%10 = fadd double %6, %9
%11 = fneg double %10
%12 = select i1 %2, double %11, double %10
ret double %12
}