#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 *strtok(char *, char *);
long strtol(char *, int /*<<< orphan*/ *, int);
int parse_time(long *rtime, long *dline, long *priod, char *arg) {
  char *str;
  str = strtok(arg, ":");
  *rtime = strtol(str, NULL, 10);
  str = strtok(NULL, ":");
  *dline = strtol(str, NULL, 10);
  str = strtok(NULL, ":");
  if (str)
    *priod = strtol(str, NULL, 10);
  else
    *priod = *dline;
  return str == NULL;
}


x86 assembly (clang, -O0):
<parse_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8d(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe5d(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11d8 <parse_time+0xb8>
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    11e6 <parse_time+0xc6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_time>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xec8(%rip),%r15
mov    %rcx,%rdi
mov    %r15,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,(%rbx)
xor    %edi,%edi
mov    %r15,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,(%r12)
xor    %edi,%edi
mov    %r15,%rsi
call   1040 <strtok@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1195 <parse_time+0x75>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
jmp    1199 <parse_time+0x79>
mov    (%r12),%rax
xor    %ecx,%ecx
test   %rbx,%rbx
sete   %cl
mov    %rax,(%r14)
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define i32 @parse_time(i64* nocapture writeonly %0, i64* nocapture %1, i64* nocapture writeonly %2, i8* %3) {
%5 = tail call i8* @strtok(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i64 @strtol(i8* nocapture %5, i32* null, i32 10)
store i64 %6, i64* %0
%7 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i64 @strtol(i8* nocapture %7, i32* null, i32 10)
store i64 %8, i64* %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 = %4
%12 = tail call i64 @strtol(i8* nocapture %9, i32* null, i32 10)
br label %15
13: ; preds = %4
%14 = load i64, i64* %1
br label %15
15: ; preds = %13, %11
%16 = phi i64 [ %14, %13 ], [ %12, %11 ]
store i64 %16, i64* %2
%17 = zext i1 %10 to i32
ret i32 %17
}