#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 *my_strsep(char **, char const *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char tab[] = "Daamn daniel you are beautiful";
  char *buffer = &tab[0];
  const char delim[] = " ";
  char **stringp = &buffer;
  char *test = my_strsep(stringp, delim);
  printf("%s\n", buffer);
  printf("%s\n", test);
  printf("%s\n", *stringp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0xebb(%rip),%al
mov    %al,-0x2(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0xeaa(%rip),%ax
mov    %ax,-0x2a(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x2a(%rbp),%rsi
call   1040 <my_strsep@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0x1f(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,0x8(%rsp)
movw   $0x20,0x6(%rsp)
lea    0x8(%rsp),%rdi
lea    0x6(%rsp),%rsi
call   1040 <my_strsep@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rsi
lea    0xeb1(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.tab = [31 x i8] c"Daamn daniel you are beautiful\00"
@__const.main.delim = [2 x i8] c" \00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = alloca i8*
%3 = alloca [2 x i8]
%4 = alloca i8**
%5 = alloca i8*
%6 = bitcast [31 x i8]* %1 to i8*
%7 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
store i8* %7, i8** %2
%8 = bitcast [2 x i8]* %3 to i8*
store i8** %2, i8*** %4
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%11 = call i8* @my_strsep(i8** %9, i8* %10)
store i8* %11, i8** %5
%12 = load i8*, i8** %2
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i8**, i8*** %4
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tab = [31 x i8] c"Daamn daniel you are beautiful\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = alloca i8*
%3 = alloca i16
%4 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%5 = bitcast i8** %2 to i8*
store i8* %4, i8** %2
%6 = bitcast i16* %3 to i8*
store i16 32, i16* %3
%7 = call i8* @my_strsep(i8** %2, i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
ret i32 0
}