#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 *);
unsigned int atoi(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ isdigit(char);
char *strdup(char const *);
int strlen(char *);
char *strtok(char *, char *);
int time_split(const char *str, float *ms, unsigned int *mult) {
  register int n, i;
  char *s, *tmp;
  tmp = strdup(str);
  for (n = 0; n <= 1; n++) {
    if (n == 0)
      s = strtok(tmp, ",");
    else
      s = strtok(NULL, ",");
    if (s == NULL)
      return 1;
    for (i = 0; i < strlen(s); i++) {
      if (isdigit(s[i]) == 0)
        return 1;
    }
    if (n == 0)
      *ms = atof(s);
    else
      *mult = atoi(s);
  }
  free(tmp);
  return 0;
}


x86 assembly (clang, -O0):
<time_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jg     1291 <time_split+0x121>
cmpl   $0x0,-0x24(%rbp)
jne    11c5 <time_split+0x55>
mov    -0x38(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x30(%rbp)
jmp    11d9 <time_split+0x69>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe30(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11f0 <time_split+0x80>
movl   $0x1,-0x4(%rbp)
jmp    12a1 <time_split+0x131>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    124d <time_split+0xdd>
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
jne    123a <time_split+0xca>
movl   $0x1,-0x4(%rbp)
jmp    12a1 <time_split+0x131>
jmp    123f <time_split+0xcf>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11f7 <time_split+0x87>
cmpl   $0x0,-0x24(%rbp)
jne    126d <time_split+0xfd>
mov    -0x30(%rbp),%rdi
call   1050 <atof@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    127e <time_split+0x10e>
mov    -0x30(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1283 <time_split+0x113>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1198 <time_split+0x28>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_split>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r13
call   1090 <strdup@plt>
mov    %rax,%r15
lea    0xe70(%rip),%rsi
mov    %rax,%rdi
call   1070 <strtok@plt>
mov    $0x1,%r12d
test   %rax,%rax
je     1257 <time_split+0xe7>
mov    %rax,%rbp
mov    %rax,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    11e6 <time_split+0x76>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl 0x0(%rbp,%rbx,1),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     1257 <time_split+0xe7>
add    $0x1,%rbx
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11c0 <time_split+0x50>
mov    %rbp,%rdi
call   1050 <atof@plt>
movss  %xmm0,0x0(%r13)
lea    0xe05(%rip),%rsi
xor    %edi,%edi
call   1070 <strtok@plt>
test   %rax,%rax
je     1257 <time_split+0xe7>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1241 <time_split+0xd1>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%rbp,1),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     1257 <time_split+0xe7>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1220 <time_split+0xb0>
mov    %rbx,%rdi
call   1080 <atoi@plt>
mov    %eax,(%r14)
mov    %r15,%rdi
call   1030 <free@plt>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
define i32 @time_split(i8* nocapture %0, float* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = tail call i8* @strdup(i8* %0)
%5 = tail call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %42, label %7
7: ; preds = %3
%8 = tail call i32 @strlen(i8* %5)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %14, label %21
10: ; preds = %14
%11 = tail call i32 @strlen(i8* %5)
%12 = sext i32 %11 to i64
%13 = icmp slt i64 %20, %12
br i1 %13, label %14, label %21
14: ; preds = %7, %10
%15 = phi i64 [ %20, %10 ], [ 0, %7 ]
%16 = getelementptr inbounds i8, i8* %5, i64 %15
%17 = load i8, i8* %16
%18 = tail call i64 @isdigit(i8 signext %17)
%19 = icmp eq i64 %18, 0
%20 = add nuw nsw i64 %15, 1
br i1 %19, label %42, label %10
21: ; preds = %10, %7
%22 = tail call float @atof(i8* %5)
store float %22, float* %1
%23 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i8* %23, null
br i1 %24, label %42, label %25
25: ; preds = %21
%26 = tail call i32 @strlen(i8* %23)
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %39
28: ; preds = %25, %35
%29 = phi i64 [ %34, %35 ], [ 0, %25 ]
%30 = getelementptr inbounds i8, i8* %23, i64 %29
%31 = load i8, i8* %30
%32 = tail call i64 @isdigit(i8 signext %31)
%33 = icmp eq i64 %32, 0
%34 = add nuw nsw i64 %29, 1
br i1 %33, label %42, label %35
35: ; preds = %28
%36 = tail call i32 @strlen(i8* %23)
%37 = sext i32 %36 to i64
%38 = icmp slt i64 %34, %37
br i1 %38, label %28, label %39
39: ; preds = %35, %25
%40 = tail call i32 @atoi(i8* %23)
store i32 %40, i32* %2
%41 = tail call i32 @free(i8* %4)
br label %42
42: ; preds = %14, %28, %3, %21, %39
%43 = phi i32 [ 0, %39 ], [ 1, %21 ], [ 1, %3 ], [ 1, %28 ], [ 1, %14 ]
ret i32 %43
}