#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*/ ft_strdel(char **);
char *ft_strdup(char *);
char *ft_strndup(char *, size_t);
void gnd_extract_content(char **stock, char **line, char *delim,
                         size_t size_delim) {
  size_t size;
  char *ptr;
  ptr = *stock;
  size = (size_t)delim - (size_t)*stock;
  *line = ft_strndup(*stock, size);
  *stock = ft_strdup(delim + size_delim);
  ft_strdel(&ptr);
}


x86 assembly (clang, -O0):
<gnd_extract_content>:
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    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <ft_strndup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
add    -0x20(%rbp),%rdi
call   1050 <ft_strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x30(%rbp),%rdi
call   1040 <ft_strdel@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnd_extract_content>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    (%rdi),%rdi
mov    %rdi,(%rsp)
mov    %rdx,%rsi
sub    %rdi,%rsi
call   1030 <ft_strndup@plt>
mov    %rax,(%r15)
add    %r14,%rbx
mov    %rbx,%rdi
call   1050 <ft_strdup@plt>
mov    %rax,(%r12)
mov    %rsp,%rdi
call   1040 <ft_strdel@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gnd_extract_content(i8** %0, i8** %1, i8* %2, i64 %3) {
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
store i8** %0, i8*** %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
store i8* %12, i8** %10
%13 = load i8*, i8** %7
%14 = ptrtoint i8* %13 to i64
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
%17 = ptrtoint i8* %16 to i64
%18 = sub i64 %14, %17
store i64 %18, i64* %9
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
%21 = load i64, i64* %9
%22 = call i8* @ft_strndup(i8* %20, i64 %21)
%23 = load i8**, i8*** %6
store i8* %22, i8** %23
%24 = load i8*, i8** %7
%25 = load i64, i64* %8
%26 = getelementptr inbounds i8, i8* %24, i64 %25
%27 = call i8* @ft_strdup(i8* %26)
%28 = load i8**, i8*** %5
store i8* %27, i8** %28
%29 = call i32 @ft_strdel(i8** %10)
ret void
}

LLVM IR (-O2):
define void @gnd_extract_content(i8** nocapture %0, i8** nocapture writeonly %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
%7 = load i8*, i8** %0
store i8* %7, i8** %5
%8 = ptrtoint i8* %2 to i64
%9 = ptrtoint i8* %7 to i64
%10 = sub i64 %8, %9
%11 = tail call i8* @ft_strndup(i8* %7, i64 %10)
store i8* %11, i8** %1
%12 = getelementptr inbounds i8, i8* %2, i64 %3
%13 = tail call i8* @ft_strdup(i8* %12)
store i8* %13, i8** %0
%14 = call i32 @ft_strdel(i8** %5)
ret void
}