#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 */
typedef long long uint32_t;
typedef scalar_t__ int8_t;
typedef long long int64_t;
typedef long long int32_t;

/* Variables and functions */
void yodel_format_hppos2position(int32_t whole, int8_t fraction,
                                 uint32_t *degreesp, uint32_t *minutesp,
                                 uint32_t *secondsp,
                                 uint32_t *onehundredthousandsthp,
                                 int *directionp) {
  int64_t nanodegrees = 0;
  nanodegrees = whole;
  nanodegrees *= 100LL;
  nanodegrees += fraction;
  if (nanodegrees < 0) {
    nanodegrees = -nanodegrees;
    *directionp = -1;
  } else {
    *directionp = 1;
  }
  *degreesp = nanodegrees / 1000000000ULL;
  nanodegrees = nanodegrees % 1000000000ULL;
  nanodegrees *= 60ULL;
  *minutesp = nanodegrees / 1000000000LL;
  nanodegrees = nanodegrees % 1000000000LL;
  nanodegrees *= 60ULL;
  *secondsp = nanodegrees / 1000000000LL;
  nanodegrees = nanodegrees % 1000000000LL;
  *onehundredthousandsthp = (nanodegrees * 100000LL) / 1000000000LL;
}


x86 assembly (clang, -O0):
<yodel_format_hppos2position>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
imul   $0x64,-0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jge    1169 <yodel_format_hppos2position+0x69>
xor    %eax,%eax
sub    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1173 <yodel_format_hppos2position+0x73>
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x38(%rbp)
imul   $0x3c,-0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x38(%rbp)
imul   $0x3c,-0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x38(%rbp)
imul   $0x186a0,-0x38(%rbp),%rax
mov    $0x3b9aca00,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<yodel_format_hppos2position>:
mov    %rdx,%r10
mov    0x8(%rsp),%rax
imul   $0x64,%rdi,%rdx
xor    %edi,%edi
add    %rsi,%rdx
setns  %dil
lea    (%rdi,%rdi,1),%esi
add    $0xffffffff,%esi
mov    %rdx,%rdi
neg    %rdi
cmovs  %rdx,%rdi
mov    %esi,(%rax)
mov    %rdi,%rax
shr    $0x9,%rax
movabs $0x44b82fa09b5a53,%rsi
mul    %rsi
shr    $0xb,%rdx
mov    %rdx,(%r10)
imul   $0x3b9aca00,%rdx,%rax
sub    %rax,%rdi
imul   $0x3c,%rdi,%rdi
mov    %rdi,%rax
shr    $0x9,%rax
mul    %rsi
shr    $0xb,%rdx
mov    %rdx,(%rcx)
imul   $0x3b9aca00,%rdx,%rax
sub    %rax,%rdi
imul   $0x3c,%rdi,%rcx
mov    %rcx,%rax
shr    $0x9,%rax
mul    %rsi
shr    $0xb,%rdx
mov    %rdx,(%r8)
imul   $0x3b9aca00,%rdx,%rax
sub    %rax,%rcx
mov    $0xd1b71759,%eax
imul   %rcx,%rax
shr    $0x2d,%rax
mov    %rax,(%r9)
ret

LLVM IR (-O0):
define void @yodel_format_hppos2position(i64 %0, i64 %1, i64* %2, i64* %3, i64* %4, i64* %5, i32* %6) {
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64*
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca i64*
%14 = alloca i32*
%15 = alloca i64
store i64 %0, i64* %8
store i64 %1, i64* %9
store i64* %2, i64** %10
store i64* %3, i64** %11
store i64* %4, i64** %12
store i64* %5, i64** %13
store i32* %6, i32** %14
store i64 0, i64* %15
%16 = load i64, i64* %8
store i64 %16, i64* %15
%17 = load i64, i64* %15
%18 = mul nsw i64 %17, 100
store i64 %18, i64* %15
%19 = load i64, i64* %9
%20 = load i64, i64* %15
%21 = add nsw i64 %20, %19
store i64 %21, i64* %15
%22 = load i64, i64* %15
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %7
%25 = load i64, i64* %15
%26 = sub nsw i64 0, %25
store i64 %26, i64* %15
%27 = load i32*, i32** %14
store i32 -1, i32* %27
br label %30
28: ; preds = %7
%29 = load i32*, i32** %14
store i32 1, i32* %29
br label %30
30: ; preds = %28, %24
%31 = load i64, i64* %15
%32 = udiv i64 %31, 1000000000
%33 = load i64*, i64** %10
store i64 %32, i64* %33
%34 = load i64, i64* %15
%35 = urem i64 %34, 1000000000
store i64 %35, i64* %15
%36 = load i64, i64* %15
%37 = mul i64 %36, 60
store i64 %37, i64* %15
%38 = load i64, i64* %15
%39 = sdiv i64 %38, 1000000000
%40 = load i64*, i64** %11
store i64 %39, i64* %40
%41 = load i64, i64* %15
%42 = srem i64 %41, 1000000000
store i64 %42, i64* %15
%43 = load i64, i64* %15
%44 = mul i64 %43, 60
store i64 %44, i64* %15
%45 = load i64, i64* %15
%46 = sdiv i64 %45, 1000000000
%47 = load i64*, i64** %12
store i64 %46, i64* %47
%48 = load i64, i64* %15
%49 = srem i64 %48, 1000000000
store i64 %49, i64* %15
%50 = load i64, i64* %15
%51 = mul nsw i64 %50, 100000
%52 = sdiv i64 %51, 1000000000
%53 = load i64*, i64** %13
store i64 %52, i64* %53
ret void
}

LLVM IR (-O2):
define void @yodel_format_hppos2position(i64 %0, i64 %1, i64* nocapture writeonly %2, i64* nocapture writeonly %3, i64* nocapture writeonly %4, i64* nocapture writeonly %5, i32* nocapture writeonly %6) {
%8 = mul nsw i64 %0, 100
%9 = add nsw i64 %8, %1
%10 = icmp slt i64 %9, 0
%11 = sub nsw i64 0, %9
%12 = select i1 %10, i32 -1, i32 1
%13 = select i1 %10, i64 %11, i64 %9
store i32 %12, i32* %6
%14 = udiv i64 %13, 1000000000
store i64 %14, i64* %2
%15 = urem i64 %13, 1000000000
%16 = mul nuw nsw i64 %15, 60
%17 = udiv i64 %16, 1000000000
store i64 %17, i64* %3
%18 = urem i64 %16, 1000000000
%19 = mul nuw nsw i64 %18, 60
%20 = udiv i64 %19, 1000000000
store i64 %20, i64* %4
%21 = urem i64 %19, 1000000000
%22 = trunc i64 %21 to i32
%23 = udiv i32 %22, 10000
%24 = zext i32 %23 to i64
store i64 %24, i64* %5
ret void
}