#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 ft_countword(char const *, char);
int /*<<< orphan*/ ft_split(char **, char const *, char);
char **ft_taballoc(int);
char **ft_strsplit(char const *s, char c) {
  char **new;
  int nbword;
  if (s == NULL)
    return (ft_taballoc(0));
  nbword = ft_countword(s, c);
  if (!(new = ft_taballoc(nbword)))
    return (NULL);
  ft_split(new, s, c);
  return (new);
}


x86 assembly (clang, -O0):
<ft_strsplit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <ft_strsplit+0x2d>
xor    %edi,%edi
call   1040 <ft_taballoc@plt>
mov    %rax,-0x8(%rbp)
jmp    11a9 <ft_strsplit+0x79>
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <ft_countword@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <ft_taballoc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1190 <ft_strsplit+0x60>
movq   $0x0,-0x8(%rbp)
jmp    11a9 <ft_strsplit+0x79>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1050 <ft_split@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strsplit>:
test   %rdi,%rdi
je     1167 <ft_strsplit+0x37>
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movsbl %sil,%r14d
mov    %r14d,%esi
call   1030 <ft_countword@plt>
mov    %eax,%edi
call   1040 <ft_taballoc@plt>
test   %rax,%rax
je     116e <ft_strsplit+0x3e>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <ft_split@plt>
jmp    1170 <ft_strsplit+0x40>
xor    %edi,%edi
jmp    1040 <ft_taballoc@plt>
xor    %ebp,%ebp
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8** @ft_strsplit(i8* %0, i8 signext %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i8** @ft_taballoc(i32 0)
store i8** %11, i8*** %3
br label %26
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i8, i8* %5
%15 = call i32 @ft_countword(i8* %13, i8 signext %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = call i8** @ft_taballoc(i32 %16)
store i8** %17, i8*** %6
%18 = icmp ne i8** %17, null
br i1 %18, label %20, label %19
19: ; preds = %12
store i8** null, i8*** %3
br label %26
20: ; preds = %12
%21 = load i8**, i8*** %6
%22 = load i8*, i8** %4
%23 = load i8, i8* %5
%24 = call i32 @ft_split(i8** %21, i8* %22, i8 signext %23)
%25 = load i8**, i8*** %6
store i8** %25, i8*** %3
br label %26
26: ; preds = %20, %19, %10
%27 = load i8**, i8*** %3
ret i8** %27
}

LLVM IR (-O2):
define i8** @ft_strsplit(i8* %0, i8 signext %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8** @ft_taballoc(i32 0)
br label %12
6: ; preds = %2
%7 = tail call i32 @ft_countword(i8* %0, i8 signext %1)
%8 = tail call i8** @ft_taballoc(i32 %7)
%9 = icmp eq i8** %8, null
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @ft_split(i8** %8, i8* %0, i8 signext %1)
br label %12
12: ; preds = %6, %10, %4
%13 = phi i8** [ %5, %4 ], [ %8, %10 ], [ null, %6 ]
ret i8** %13
}