#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 */
struct wlist_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wlist_build_from_str_static_size(struct wlist_t *, char *,
                                                    int, int);
struct wlist_t *wlist_build_from_str(struct wlist_t *wlist, char *str,
                                     int sz_str, int sz_token_max) {
  int sz_token;
  if (!wlist || !str || (sz_str <= 0) || !sz_token_max)
    return NULL;
  for (sz_token = 1; sz_token <= sz_token_max; sz_token++)
    wlist_build_from_str_static_size(wlist, str, sz_str, sz_token);
  return wlist;
}


x86 assembly (clang, -O0):
<wlist_build_from_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1150 <wlist_build_from_str+0x40>
cmpq   $0x0,-0x18(%rbp)
je     1150 <wlist_build_from_str+0x40>
cmpl   $0x0,-0x1c(%rbp)
jle    1150 <wlist_build_from_str+0x40>
cmpl   $0x0,-0x20(%rbp)
jne    115d <wlist_build_from_str+0x4d>
movq   $0x0,-0x8(%rbp)
jmp    1199 <wlist_build_from_str+0x89>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1191 <wlist_build_from_str+0x81>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1030 <wlist_build_from_str_static_size@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1164 <wlist_build_from_str+0x54>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wlist_build_from_str>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     1176 <wlist_build_from_str+0x66>
mov    %rsi,%r12
test   %rsi,%rsi
je     1176 <wlist_build_from_str+0x66>
mov    %edx,%r15d
test   %edx,%edx
jle    1176 <wlist_build_from_str+0x66>
mov    %ecx,%r14d
test   %ecx,%ecx
je     1176 <wlist_build_from_str+0x66>
mov    %rdi,%rbx
jle    1173 <wlist_build_from_str+0x63>
neg    %r14d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %ebp,%ecx
call   1030 <wlist_build_from_str_static_size@plt>
lea    (%r14,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1150 <wlist_build_from_str+0x40>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.wlist_t = type { i32 }
define %struct.wlist_t* @wlist_build_from_str(%struct.wlist_t* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.wlist_t*
%6 = alloca %struct.wlist_t*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.wlist_t* %0, %struct.wlist_t** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load %struct.wlist_t*, %struct.wlist_t** %6
%12 = icmp ne %struct.wlist_t* %11, null
br i1 %12, label %13, label %22
13: ; preds = %4
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* %8
%18 = icmp sle i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %9
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %19, %16, %13, %4
store %struct.wlist_t* null, %struct.wlist_t** %5
br label %39
23: ; preds = %19
store i32 1, i32* %10
br label %24
24: ; preds = %34, %23
%25 = load i32, i32* %10
%26 = load i32, i32* %9
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %37
28: ; preds = %24
%29 = load %struct.wlist_t*, %struct.wlist_t** %6
%30 = load i8*, i8** %7
%31 = load i32, i32* %8
%32 = load i32, i32* %10
%33 = call i32 @wlist_build_from_str_static_size(%struct.wlist_t* %29, i8* %30, i32 %31, i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %24
37: ; preds = %24
%38 = load %struct.wlist_t*, %struct.wlist_t** %6
store %struct.wlist_t* %38, %struct.wlist_t** %5
br label %39
39: ; preds = %37, %22
%40 = load %struct.wlist_t*, %struct.wlist_t** %5
ret %struct.wlist_t* %40
}

LLVM IR (-O2):
%struct.wlist_t = type { i32 }
define %struct.wlist_t* @wlist_build_from_str(%struct.wlist_t* %0, i8* %1, i32 %2, i32 %3) {
%5 = icmp eq %struct.wlist_t* %0, null
%6 = icmp eq i8* %1, null
%7 = or i1 %5, %6
%8 = icmp slt i32 %2, 1
%9 = or i1 %7, %8
%10 = icmp eq i32 %3, 0
%11 = or i1 %9, %10
br i1 %11, label %19, label %12
12: ; preds = %4
%13 = icmp slt i32 %3, 1
br i1 %13, label %19, label %14
14: ; preds = %12, %14
%15 = phi i32 [ %17, %14 ], [ 1, %12 ]
%16 = tail call i32 @wlist_build_from_str_static_size(%struct.wlist_t* %0, i8* %1, i32 %2, i32 %15)
%17 = add nuw i32 %15, 1
%18 = icmp eq i32 %15, %3
br i1 %18, label %19, label %14
19: ; preds = %14, %12, %4
%20 = phi %struct.wlist_t* [ null, %4 ], [ %0, %12 ], [ %0, %14 ]
ret %struct.wlist_t* %20
}