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

/* Variables and functions */
unsigned long long abs64(int);
void yodel_format_hpalt2aaltitude(int32_t whole, int8_t fraction,
                                  int32_t *metersp, uint32_t *tenthousandthsp) {
  int64_t tenthousandsth = 0;
  tenthousandsth = whole;
  tenthousandsth *= 10;
  tenthousandsth += fraction;
  *metersp = tenthousandsth / 10000LL;
  *tenthousandthsp = abs64(tenthousandsth) % 10000ULL;
}


x86 assembly (clang, -O0):
<yodel_format_hpalt2aaltitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
imul   $0xa,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
mov    $0x2710,%ecx
cqto
idiv   %rcx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%edi
call   1030 <abs64@plt>
mov    $0x2710,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x20(%rbp),%rax
mov    %rdx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yodel_format_hpalt2aaltitude>:
push   %rbx
mov    %rcx,%rbx
lea    (%rdi,%rdi,4),%eax
lea    (%rsi,%rax,2),%eax
movslq %eax,%rdi
imul   $0x68db8bad,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
mov    %eax,(%rdx)
call   1030 <abs64@plt>
mov    %rax,%rcx
movabs $0x346dc5d63886594b,%rdx
c5 6d 34
mul    %rdx
shr    $0xb,%rdx
imul   $0x2710,%rdx,%rax
sub    %rax,%rcx
mov    %rcx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @yodel_format_hpalt2aaltitude(i32 %0, i64 %1, i32* %2, i64* %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i64*
%9 = alloca i32
store i32 %0, i32* %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i64* %3, i64** %8
store i32 0, i32* %9
%10 = load i32, i32* %5
store i32 %10, i32* %9
%11 = load i32, i32* %9
%12 = mul nsw i32 %11, 10
store i32 %12, i32* %9
%13 = load i64, i64* %6
%14 = load i32, i32* %9
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %9
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = sdiv i64 %19, 10000
%21 = trunc i64 %20 to i32
%22 = load i32*, i32** %7
store i32 %21, i32* %22
%23 = load i32, i32* %9
%24 = call i64 @abs64(i32 %23)
%25 = urem i64 %24, 10000
%26 = load i64*, i64** %8
store i64 %25, i64* %26
ret void
}

LLVM IR (-O2):
define void @yodel_format_hpalt2aaltitude(i32 %0, i64 %1, i32* nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = mul nsw i32 %0, 10
%6 = trunc i64 %1 to i32
%7 = add i32 %5, %6
%8 = sdiv i32 %7, 10000
store i32 %8, i32* %2
%9 = tail call i64 @abs64(i32 %7)
%10 = urem i64 %9, 10000
store i64 %10, i64* %3
ret void
}