#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 *strdup(char *);
char *strtok(char *, char *);
void get_type_and_prefix(char *arg, char **type, char **prefix) {
  char *first, *second;
  *type = *prefix = 0;
  first = strtok(arg, ":");
  second = strtok(0, ":");
  if (first == 0 || second == 0)
    return;
  *type = strdup(first);
  *prefix = strdup(second);
}


x86 assembly (clang, -O0):
<get_type_and_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe97(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1188 <get_type_and_prefix+0x68>
cmpq   $0x0,-0x28(%rbp)
jne    118d <get_type_and_prefix+0x6d>
jmp    11b3 <get_type_and_prefix+0x93>
mov    -0x20(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_type_and_prefix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
movq   $0x0,(%rdx)
movq   $0x0,(%rsi)
lea    0xebd(%rip),%r12
mov    %r12,%rsi
call   1030 <strtok@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r12,%rsi
call   1030 <strtok@plt>
test   %rbx,%rbx
je     117b <get_type_and_prefix+0x5b>
mov    %rax,%r12
test   %rax,%rax
je     117b <get_type_and_prefix+0x5b>
mov    %rbx,%rdi
call   1040 <strdup@plt>
mov    %rax,(%r15)
mov    %r12,%rdi
call   1040 <strdup@plt>
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define void @get_type_and_prefix(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
store i8* null, i8** %2
store i8* null, i8** %1
%4 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %4, null
%7 = icmp eq i8* %5, null
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i8* @strdup(i8* %4)
store i8* %10, i8** %1
%11 = tail call i8* @strdup(i8* %5)
store i8* %11, i8** %2
br label %12
12: ; preds = %3, %9
ret void
}