#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 abs(int);
void roadmap_driver_to_nmea(int value, int *ddmm, int *mmmm) {
  int degrees;
  int minutes;
  value = abs(value);
  degrees = value / 1000000;
  value = 60 * (value % 1000000);
  minutes = value / 1000000;
  *ddmm = degrees * 100 + minutes;
  *mmmm = (value % 1000000) / 100;
}


x86 assembly (clang, -O0):
<roadmap_driver_to_nmea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
imul   $0x3c,%edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
imul   $0x64,-0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_driver_to_nmea>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
imul   $0x431bde83,%rax,%rcx
shr    $0x32,%rcx
imul   $0xf4240,%ecx,%edi
sub    %edi,%eax
imul   $0x3c,%eax,%eax
imul   $0x64,%ecx,%ecx
imul   $0x431bde83,%rax,%rdi
shr    $0x32,%rdi
add    %edi,%ecx
mov    %ecx,(%rsi)
imul   $0xf4240,%edi,%ecx
sub    %ecx,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @roadmap_driver_to_nmea(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
%10 = call i32 @abs(i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = sdiv i32 %11, 1000000
store i32 %12, i32* %7
%13 = load i32, i32* %4
%14 = srem i32 %13, 1000000
%15 = mul nsw i32 60, %14
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = sdiv i32 %16, 1000000
store i32 %17, i32* %8
%18 = load i32, i32* %7
%19 = mul nsw i32 %18, 100
%20 = load i32, i32* %8
%21 = add nsw i32 %19, %20
%22 = load i32*, i32** %5
store i32 %21, i32* %22
%23 = load i32, i32* %4
%24 = srem i32 %23, 1000000
%25 = sdiv i32 %24, 100
%26 = load i32*, i32** %6
store i32 %25, i32* %26
ret void
}

LLVM IR (-O2):
define void @roadmap_driver_to_nmea(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%5 = udiv i32 %4, 1000000
%6 = urem i32 %4, 1000000
%7 = mul nuw nsw i32 %6, 60
%8 = udiv i32 %7, 1000000
%9 = mul nuw nsw i32 %5, 100
%10 = add nuw nsw i32 %8, %9
store i32 %10, i32* %1
%11 = urem i32 %7, 1000000
%12 = udiv i32 %11, 100
store i32 %12, i32* %2
ret void
}