#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 */
char atoi(char *);
char *strtok(char *, char *);
void tok2msf(char *time, char *msf) {
  char *token;
  token = strtok(time, ":");
  if (token) {
    msf[0] = atoi(token);
  } else {
    msf[0] = 0;
  }
  token = strtok(NULL, ":");
  if (token) {
    msf[1] = atoi(token);
  } else {
    msf[1] = 0;
  }
  token = strtok(NULL, ":");
  if (token) {
    msf[2] = atoi(token);
  } else {
    msf[2] = 0;
  }
}


x86 assembly (clang, -O0):
<tok2msf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1165 <tok2msf+0x45>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    116c <tok2msf+0x4c>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe89(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a2 <tok2msf+0x82>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
jmp    11aa <tok2msf+0x8a>
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe4b(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11e0 <tok2msf+0xc0>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
jmp    11e8 <tok2msf+0xc8>
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tok2msf>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xed2(%rip),%rsi
call   1030 <strtok@plt>
test   %rax,%rax
je     1142 <tok2msf+0x22>
mov    %rax,%rdi
call   1040 <atoi@plt>
jmp    1144 <tok2msf+0x24>
xor    %eax,%eax
mov    %al,(%r14)
lea    0xeb2(%rip),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <strtok@plt>
test   %rax,%rax
je     1166 <tok2msf+0x46>
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    %bl,0x1(%r14)
lea    0xe8f(%rip),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <strtok@plt>
test   %rax,%rax
je     1189 <tok2msf+0x69>
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    %bl,0x2(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define void @tok2msf(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call signext i8 @atoi(i8* %11)
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 %12, i8* %14
br label %18
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 0, i8* %17
br label %18
18: ; preds = %15, %10
%19 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %19, i8** %5
%20 = load i8*, i8** %5
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = call signext i8 @atoi(i8* %23)
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 1
store i8 %24, i8* %26
br label %30
27: ; preds = %18
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 1
store i8 0, i8* %29
br label %30
30: ; preds = %27, %22
%31 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %31, i8** %5
%32 = load i8*, i8** %5
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i8*, i8** %5
%36 = call signext i8 @atoi(i8* %35)
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 2
store i8 %36, i8* %38
br label %42
39: ; preds = %30
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 2
store i8 0, i8* %41
br label %42
42: ; preds = %39, %34
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define void @tok2msf(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call signext i8 @atoi(i8* %3)
br label %7
7: ; preds = %2, %5
%8 = phi i8 [ %6, %5 ], [ 0, %2 ]
store i8 %8, i8* %1
%9 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call signext i8 @atoi(i8* %9)
br label %13
13: ; preds = %7, %11
%14 = phi i8 [ %12, %11 ], [ 0, %7 ]
%15 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %14, i8* %15
%16 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = tail call signext i8 @atoi(i8* %16)
br label %20
20: ; preds = %13, %18
%21 = phi i8 [ %19, %18 ], [ 0, %13 ]
%22 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %21, i8* %22
ret void
}