#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 */
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *strtok(char *, char *);
void strsplit4(char *string, char sep, char *first, char *second) {
  char *copy = strdup(string);
  char *token;
  char sep_str[2];
  sep_str[0] = sep;
  sep_str[1] = '\0';
  token = strtok(copy, sep_str);
  strcpy(first, token);
  token = strtok(NULL, sep_str);
  strcpy(second, token);
}


x86 assembly (clang, -O0):
<strsplit4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x32(%rbp)
movb   $0x0,-0x31(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x32(%rbp),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x32(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1040 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsplit4>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
call   1050 <strdup@plt>
mov    %bpl,0xe(%rsp)
movb   $0x0,0xf(%rsp)
lea    0xe(%rsp),%rbp
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strtok@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1040 <strtok@plt>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define void @strsplit4(i8* %0, i8 signext %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [2 x i8]
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%12 = load i8*, i8** %5
%13 = call i8* @strdup(i8* %12)
store i8* %13, i8** %9
%14 = load i8, i8* %6
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
store i8 %14, i8* %15
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 1
store i8 0, i8* %16
%17 = load i8*, i8** %9
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
%19 = call i8* @strtok(i8* %17, i8* %18)
store i8* %19, i8** %10
%20 = load i8*, i8** %7
%21 = load i8*, i8** %10
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
%24 = call i8* @strtok(i8* null, i8* %23)
store i8* %24, i8** %10
%25 = load i8*, i8** %8
%26 = load i8*, i8** %10
%27 = call i32 @strcpy(i8* %25, i8* %26)
ret void
}

LLVM IR (-O2):
define void @strsplit4(i8* nocapture %0, i8 signext %1, i8* %2, i8* %3) {
%5 = alloca [2 x i8]
%6 = tail call i8* @strdup(i8* %0)
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %1, i8* %7
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 0, i8* %8
%9 = call i8* @strtok(i8* %6, i8* %7)
%10 = tail call i32 @strcpy(i8* %2, i8* %9)
%11 = call i8* @strtok(i8* null, i8* %7)
%12 = tail call i32 @strcpy(i8* %3, i8* %11)
ret void
}