#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 atoi(char *);
int roadmap_gpsd2_decode_numeric(char const *);
char *strchr(char const *, char);
int roadmap_gpsd2_decode_coordinate(const char *input) {
  char *point = strchr(input, '.');
  if (point != NULL) {
    const char *from;
    int i;
    char *to;
    char modified[16];
    to = modified;
    for (from = input; from < point; ++from) {
      *(to++) = *from;
    }
    for (from = point + 1, i = 0; *from > 0 && i < 6; ++from, ++i) {
      *(to++) = *from;
    }
    while (i++ < 6)
      *(to++) = '0';
    *to = 0;
    return atoi(modified);
  }
  return roadmap_gpsd2_decode_numeric(input);
}


x86 assembly (clang, -O0):
<roadmap_gpsd2_decode_coordinate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     125a <roadmap_gpsd2_decode_coordinate+0x12a>
lea    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    119f <roadmap_gpsd2_decode_coordinate+0x6f>
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1169 <roadmap_gpsd2_decode_coordinate+0x39>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x41(%rbp)
jle    11d1 <roadmap_gpsd2_decode_coordinate+0xa1>
cmpl   $0x6,-0x24(%rbp)
setl   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11e1 <roadmap_gpsd2_decode_coordinate+0xb1>
jmp    1212 <roadmap_gpsd2_decode_coordinate+0xe2>
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b2 <roadmap_gpsd2_decode_coordinate+0x82>
jmp    1217 <roadmap_gpsd2_decode_coordinate+0xe7>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
cmp    $0x6,%eax
jge    1242 <roadmap_gpsd2_decode_coordinate+0x112>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0x30,(%rax)
jmp    1217 <roadmap_gpsd2_decode_coordinate+0xe7>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x40(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1266 <roadmap_gpsd2_decode_coordinate+0x136>
mov    -0x10(%rbp),%rdi
call   1040 <roadmap_gpsd2_decode_numeric@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_gpsd2_decode_coordinate>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1189 <roadmap_gpsd2_decode_coordinate+0x39>
mov    %rax,%r15
mov    %rax,%r14
sub    %rbx,%r14
jbe    119a <roadmap_gpsd2_decode_coordinate+0x4a>
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <memcpy@plt>
add    %rsp,%r14
jmp    119d <roadmap_gpsd2_decode_coordinate+0x4d>
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <roadmap_gpsd2_decode_numeric@plt>
mov    %rsp,%r14
mov    0x1(%r15),%al
test   %al,%al
jle    11f7 <roadmap_gpsd2_decode_coordinate+0xa7>
mov    $0xfffffffa,%ebx
mov    %al,(%r14)
mov    0x2(%r15),%cl
mov    $0x1,%al
test   %cl,%cl
jle    11fb <roadmap_gpsd2_decode_coordinate+0xab>
mov    %cl,0x1(%r14)
mov    0x3(%r15),%cl
test   %cl,%cl
jle    1209 <roadmap_gpsd2_decode_coordinate+0xb9>
mov    %cl,0x2(%r14)
mov    0x4(%r15),%cl
test   %cl,%cl
jle    1217 <roadmap_gpsd2_decode_coordinate+0xc7>
mov    %cl,0x3(%r14)
mov    0x5(%r15),%cl
test   %cl,%cl
jle    1225 <roadmap_gpsd2_decode_coordinate+0xd5>
mov    %cl,0x4(%r14)
mov    0x6(%r15),%cl
test   %cl,%cl
jle    1262 <roadmap_gpsd2_decode_coordinate+0x112>
mov    %cl,0x5(%r14)
add    $0x6,%r14
xor    %eax,%eax
test   %al,%al
jne    1231 <roadmap_gpsd2_decode_coordinate+0xe1>
jmp    124c <roadmap_gpsd2_decode_coordinate+0xfc>
xor    %ebx,%ebx
jmp    1231 <roadmap_gpsd2_decode_coordinate+0xe1>
add    $0x1,%r14
or     $0x5,%rbx
test   %al,%al
jne    1231 <roadmap_gpsd2_decode_coordinate+0xe1>
jmp    124c <roadmap_gpsd2_decode_coordinate+0xfc>
add    $0x2,%r14
add    $0x4,%rbx
test   %al,%al
jne    1231 <roadmap_gpsd2_decode_coordinate+0xe1>
jmp    124c <roadmap_gpsd2_decode_coordinate+0xfc>
add    $0x3,%r14
add    $0x3,%rbx
test   %al,%al
jne    1231 <roadmap_gpsd2_decode_coordinate+0xe1>
jmp    124c <roadmap_gpsd2_decode_coordinate+0xfc>
add    $0x4,%r14
add    $0x2,%rbx
test   %al,%al
je     124c <roadmap_gpsd2_decode_coordinate+0xfc>
add    $0x5,%ebx
lea    0x1(%rbx),%rdx
mov    %r14,%rdi
mov    $0x30,%esi
call   1040 <memset@plt>
add    %rbx,%r14
add    $0x1,%r14
movb   $0x0,(%r14)
mov    %rsp,%rdi
call   1070 <atoi@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
add    $0x5,%r14
add    $0x1,%rbx
test   %al,%al
jne    1231 <roadmap_gpsd2_decode_coordinate+0xe1>
jmp    124c <roadmap_gpsd2_decode_coordinate+0xfc>

LLVM IR (-O0):
define i32 @roadmap_gpsd2_decode_coordinate(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [16 x i8]
store i8* %0, i8** %3
%9 = load i8*, i8** %3
%10 = call i8* @strchr(i8* %9, i8 signext 46)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %63
13: ; preds = %1
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
store i8* %14, i8** %7
%15 = load i8*, i8** %3
store i8* %15, i8** %5
br label %16
16: ; preds = %25, %13
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = icmp ult i8* %17, %18
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = load i8*, i8** %7
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %7
store i8 %22, i8* %23
br label %25
25: ; preds = %20
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
br label %16
28: ; preds = %16
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8* %30, i8** %5
store i32 0, i32* %6
br label %31
31: ; preds = %46, %28
%32 = load i8*, i8** %5
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 6
br label %39
39: ; preds = %36, %31
%40 = phi i1 [ false, %31 ], [ %38, %36 ]
br i1 %40, label %41, label %51
41: ; preds = %39
%42 = load i8*, i8** %5
%43 = load i8, i8* %42
%44 = load i8*, i8** %7
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %7
store i8 %43, i8* %44
br label %46
46: ; preds = %41
%47 = load i8*, i8** %5
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %5
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %31
51: ; preds = %39
br label %52
52: ; preds = %56, %51
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
%55 = icmp slt i32 %53, 6
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i8*, i8** %7
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %7
store i8 48, i8* %57
br label %52
59: ; preds = %52
%60 = load i8*, i8** %7
store i8 0, i8* %60
%61 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%62 = call i32 @atoi(i8* %61)
store i32 %62, i32* %2
br label %66
63: ; preds = %1
%64 = load i8*, i8** %3
%65 = call i32 @roadmap_gpsd2_decode_numeric(i8* %64)
store i32 %65, i32* %2
br label %66
66: ; preds = %63, %59
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
define i32 @roadmap_gpsd2_decode_coordinate(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%6 = ptrtoint i8* %5 to i64
%7 = icmp eq i8* %5, null
br i1 %7, label %60, label %8
8: ; preds = %1
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%10 = icmp ugt i8* %5, %0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = sub i64 %6, %2
%13 = getelementptr [16 x i8], [16 x i8]* %3, i64 0, i64 %12
br label %14
14: ; preds = %11, %8
%15 = phi i8* [ %9, %8 ], [ %13, %11 ]
%16 = getelementptr inbounds i8, i8* %5, i64 1
%17 = load i8, i8* %16
%18 = icmp sgt i8 %17, 0
br i1 %18, label %30, label %23
19: ; preds = %55, %50, %45, %40, %35, %30
%20 = phi i1 [ false, %55 ], [ true, %50 ], [ true, %45 ], [ true, %40 ], [ true, %35 ], [ true, %30 ]
%21 = phi i8* [ %56, %55 ], [ %51, %50 ], [ %46, %45 ], [ %41, %40 ], [ %36, %35 ], [ %31, %30 ]
%22 = phi i64 [ 4294967290, %55 ], [ 4294967291, %50 ], [ 4294967292, %45 ], [ 4294967293, %40 ], [ 4294967294, %35 ], [ 4294967295, %30 ]
br i1 %20, label %23, label %57
23: ; preds = %14, %19
%24 = phi i8* [ %21, %19 ], [ %15, %14 ]
%25 = phi i64 [ %22, %19 ], [ 0, %14 ]
%26 = add nsw i64 %25, 5
%27 = and i64 %26, 4294967295
%28 = add nuw nsw i64 %27, 1
%29 = getelementptr i8, i8* %24, i64 %28
br label %57
30: ; preds = %14
%31 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %17, i8* %15
%32 = getelementptr inbounds i8, i8* %5, i64 2
%33 = load i8, i8* %32
%34 = icmp sgt i8 %33, 0
br i1 %34, label %35, label %19
35: ; preds = %30
%36 = getelementptr inbounds i8, i8* %15, i64 2
store i8 %33, i8* %31
%37 = getelementptr inbounds i8, i8* %5, i64 3
%38 = load i8, i8* %37
%39 = icmp sgt i8 %38, 0
br i1 %39, label %40, label %19
40: ; preds = %35
%41 = getelementptr inbounds i8, i8* %15, i64 3
store i8 %38, i8* %36
%42 = getelementptr inbounds i8, i8* %5, i64 4
%43 = load i8, i8* %42
%44 = icmp sgt i8 %43, 0
br i1 %44, label %45, label %19
45: ; preds = %40
%46 = getelementptr inbounds i8, i8* %15, i64 4
store i8 %43, i8* %41
%47 = getelementptr inbounds i8, i8* %5, i64 5
%48 = load i8, i8* %47
%49 = icmp sgt i8 %48, 0
br i1 %49, label %50, label %19
50: ; preds = %45
%51 = getelementptr inbounds i8, i8* %15, i64 5
store i8 %48, i8* %46
%52 = getelementptr inbounds i8, i8* %5, i64 6
%53 = load i8, i8* %52
%54 = icmp sgt i8 %53, 0
br i1 %54, label %55, label %19
55: ; preds = %50
%56 = getelementptr inbounds i8, i8* %15, i64 6
store i8 %53, i8* %51
br label %19
57: ; preds = %23, %19
%58 = phi i8* [ %21, %19 ], [ %29, %23 ]
store i8 0, i8* %58
%59 = call i32 @atoi(i8* %9)
br label %62
60: ; preds = %1
%61 = tail call i32 @roadmap_gpsd2_decode_numeric(i8* %0)
br label %62
62: ; preds = %60, %57
%63 = phi i32 [ %59, %57 ], [ %61, %60 ]
ret i32 %63
}