#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 */
float atof(char *);
char *strtok(char *, char const *);
void split_sexigesimal_str(const char *str, float (*splitted)[]) {
  int tok_cnt = 0;
  const char s[2] = ":";
  char *token;
  token = strtok((char *)str, s);
  while (token != NULL) {
    if (tok_cnt >= 3) {
      return;
    }
    (*splitted)[tok_cnt] = atof(token);
    token = strtok(NULL, s);
    tok_cnt++;
  }
  if ((*splitted)[0] < 0) {
    (*splitted)[1] *= -1;
    (*splitted)[2] *= -1;
  }
}


x86 assembly (clang, -O0):
<split_sexigesimal_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0xec6(%rip),%ax
mov    %ax,-0x16(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11a2 <split_sexigesimal_str+0x82>
cmpl   $0x3,-0x14(%rbp)
jl     116d <split_sexigesimal_str+0x4d>
jmp    11de <split_sexigesimal_str+0xbe>
mov    -0x20(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
lea    -0x16(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1040 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <split_sexigesimal_str+0x33>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss (%rax),%xmm0
jbe    11de <split_sexigesimal_str+0xbe>
mov    -0x10(%rbp),%rax
movss  0xe42(%rip),%xmm0
mulss  0x4(%rax),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0xe2c(%rip),%xmm0
mulss  0x8(%rax),%xmm0
movss  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_sexigesimal_str>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movw   $0x3a,0xe(%rsp)
lea    0xe(%rsp),%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     1197 <split_sexigesimal_str+0x77>
mov    %rax,%rdi
call   1030 <atof@plt>
movss  %xmm0,(%rbx)
lea    0xe(%rsp),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     1197 <split_sexigesimal_str+0x77>
mov    %rax,%rdi
call   1030 <atof@plt>
movss  %xmm0,0x4(%rbx)
lea    0xe(%rsp),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     1197 <split_sexigesimal_str+0x77>
mov    %rax,%rdi
call   1030 <atof@plt>
movss  %xmm0,0x8(%rbx)
lea    0xe(%rsp),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
jne    11c0 <split_sexigesimal_str+0xa0>
xorps  %xmm0,%xmm0
ucomiss (%rbx),%xmm0
jbe    11c0 <split_sexigesimal_str+0xa0>
movaps 0xe5a(%rip),%xmm0
movss  0x4(%rbx),%xmm1
movss  0x8(%rbx),%xmm2
xorps  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
xorps  %xmm0,%xmm2
movss  %xmm2,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.split_sexigesimal_str.s = [2 x i8] c":\00"
define void @split_sexigesimal_str(i8* %0, [0 x float]* %1) {
%3 = alloca i8*
%4 = alloca [0 x float]*
%5 = alloca i32
%6 = alloca [2 x i8]
%7 = alloca i8*
store i8* %0, i8** %3
store [0 x float]* %1, [0 x float]** %4
store i32 0, i32* %5
%8 = bitcast [2 x i8]* %6 to i8*
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%11 = call i8* @strtok(i8* %9, i8* %10)
store i8* %11, i8** %7
br label %12
12: ; preds = %19, %2
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %30
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp sge i32 %16, 3
br i1 %17, label %18, label %19
18: ; preds = %15
br label %44
19: ; preds = %15
%20 = load i8*, i8** %7
%21 = call float @atof(i8* %20)
%22 = load [0 x float]*, [0 x float]** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [0 x float], [0 x float]* %22, i64 0, i64 %24
store float %21, float* %25
%26 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%27 = call i8* @strtok(i8* null, i8* %26)
store i8* %27, i8** %7
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %12
30: ; preds = %12
%31 = load [0 x float]*, [0 x float]** %4
%32 = getelementptr inbounds [0 x float], [0 x float]* %31, i64 0, i64 0
%33 = load float, float* %32
%34 = fcmp olt float %33, 0.000000e+00
br i1 %34, label %35, label %44
35: ; preds = %30
%36 = load [0 x float]*, [0 x float]** %4
%37 = getelementptr inbounds [0 x float], [0 x float]* %36, i64 0, i64 1
%38 = load float, float* %37
%39 = fmul float %38, -1.000000e+00
store float %39, float* %37
%40 = load [0 x float]*, [0 x float]** %4
%41 = getelementptr inbounds [0 x float], [0 x float]* %40, i64 0, i64 2
%42 = load float, float* %41
%43 = fmul float %42, -1.000000e+00
store float %43, float* %41
br label %44
44: ; preds = %18, %35, %30
ret void
}

LLVM IR (-O2):
define void @split_sexigesimal_str(i8* %0, [0 x float]* nocapture %1) {
%3 = alloca i16
%4 = bitcast i16* %3 to i8*
store i16 58, i16* %3
%5 = call i8* @strtok(i8* %0, i8* %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %22, label %7
7: ; preds = %2
%8 = tail call float @atof(i8* %5)
%9 = getelementptr inbounds [0 x float], [0 x float]* %1, i64 0, i64 0
store float %8, float* %9
%10 = call i8* @strtok(i8* null, i8* %4)
%11 = icmp eq i8* %10, null
br i1 %11, label %22, label %12
12: ; preds = %7
%13 = tail call float @atof(i8* %10)
%14 = getelementptr inbounds [0 x float], [0 x float]* %1, i64 0, i64 1
store float %13, float* %14
%15 = call i8* @strtok(i8* null, i8* %4)
%16 = icmp eq i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = tail call float @atof(i8* %15)
%19 = getelementptr inbounds [0 x float], [0 x float]* %1, i64 0, i64 2
store float %18, float* %19
%20 = call i8* @strtok(i8* null, i8* %4)
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %33
22: ; preds = %7, %12, %17, %2
%23 = getelementptr inbounds [0 x float], [0 x float]* %1, i64 0, i64 0
%24 = load float, float* %23
%25 = fcmp olt float %24, 0.000000e+00
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = getelementptr inbounds [0 x float], [0 x float]* %1, i64 0, i64 1
%28 = load float, float* %27
%29 = fneg float %28
store float %29, float* %27
%30 = getelementptr inbounds [0 x float], [0 x float]* %1, i64 0, i64 2
%31 = load float, float* %30
%32 = fneg float %31
store float %32, float* %30
br label %33
33: ; preds = %17, %22, %26
ret void
}