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

/* Variables and functions */
int errno;
struct wTrie *wTrie_spawn(int /*<<< orphan*/, struct wTrie *, int const, int,
                          int /*<<< orphan*/ *, int /*<<< orphan*/);
struct wTrie *wTrie_addnword(struct wTrie *wtr, const wchar_t *wstring, int n) {
  if (!((wstring && wtr))) {
    errno = 347;
    return NULL;
  };
  if (!((*wstring && n >= 1))) {
    errno = 346;
    return NULL;
  };
  if (*(wstring + 1) != L'\0' && n > 1) {
    struct wTrie *nwtr = wTrie_spawn(0, wtr, *wstring, 0, NULL, 0);
    return wTrie_addnword(nwtr, wstring + 1, n - 1);
  } else
    return wTrie_spawn(0, wtr, *wstring, 1, NULL, 0);
}


x86 assembly (clang, -O0):
<wTrie_addnword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1149 <wTrie_addnword+0x29>
cmpq   $0x0,-0x10(%rbp)
jne    1163 <wTrie_addnword+0x43>
mov    0x2e90(%rip),%rax
movl   $0x15b,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1210 <wTrie_addnword+0xf0>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     117a <wTrie_addnword+0x5a>
cmpl   $0x1,-0x1c(%rbp)
jge    1194 <wTrie_addnword+0x74>
mov    0x2e5f(%rip),%rax
movl   $0x15a,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1210 <wTrie_addnword+0xf0>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     11ed <wTrie_addnword+0xcd>
cmpl   $0x1,-0x1c(%rbp)
jle    11ed <wTrie_addnword+0xcd>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
xor    %r9d,%r9d
xor    %eax,%eax
mov    %eax,%r8d
mov    %r9d,%edi
mov    %r9d,%ecx
call   1030 <wTrie_spawn@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
call   1040 <wTrie_addnword@plt>
mov    %rax,-0x8(%rbp)
jmp    1210 <wTrie_addnword+0xf0>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
xor    %r9d,%r9d
mov    $0x1,%ecx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r9d,%edi
call   1030 <wTrie_spawn@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wTrie_addnword>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1163 <wTrie_addnword+0x53>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1163 <wTrie_addnword+0x53>
mov    %edx,%ebp
mov    %rdi,%rax
add    $0x4,%rbx
nopl   0x0(%rax)
test   %ebp,%ebp
jle    1172 <wTrie_addnword+0x62>
mov    -0x4(%rbx),%edx
test   %edx,%edx
je     1172 <wTrie_addnword+0x62>
cmp    $0x2,%ebp
jb     1188 <wTrie_addnword+0x78>
cmpl   $0x0,(%rbx)
je     1188 <wTrie_addnword+0x78>
xor    %edi,%edi
mov    %rax,%rsi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <wTrie_spawn@plt>
add    $0xffffffff,%ebp
add    $0x4,%rbx
test   %rax,%rax
jne    1130 <wTrie_addnword+0x20>
mov    0x2e76(%rip),%rax
movl   $0x15b,(%rax)
jmp    117f <wTrie_addnword+0x6f>
mov    0x2e67(%rip),%rax
movl   $0x15a,(%rax)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edi,%edi
mov    %rax,%rsi
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <wTrie_spawn@plt>

LLVM IR (-O0):
%struct.wTrie = type { i32 }
@errno = global i32 0
define %struct.wTrie* @wTrie_addnword(%struct.wTrie* %0, i32* %1, i32 %2) {
%4 = alloca %struct.wTrie*
%5 = alloca %struct.wTrie*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca %struct.wTrie*
store %struct.wTrie* %0, %struct.wTrie** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%9 = load i32*, i32** %6
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load %struct.wTrie*, %struct.wTrie** %5
%13 = icmp ne %struct.wTrie* %12, null
br i1 %13, label %15, label %14
14: ; preds = %11, %3
store i32 347, i32* @errno
store %struct.wTrie* null, %struct.wTrie** %4
br label %47
15: ; preds = %11
%16 = load i32*, i32** %6
%17 = load i32, i32* %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %7
%21 = icmp sge i32 %20, 1
br i1 %21, label %23, label %22
22: ; preds = %19, %15
store i32 346, i32* @errno
store %struct.wTrie* null, %struct.wTrie** %4
br label %47
23: ; preds = %19
%24 = load i32*, i32** %6
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %23
%29 = load i32, i32* %7
%30 = icmp sgt i32 %29, 1
br i1 %30, label %31, label %42
31: ; preds = %28
%32 = load %struct.wTrie*, %struct.wTrie** %5
%33 = load i32*, i32** %6
%34 = load i32, i32* %33
%35 = call %struct.wTrie* @wTrie_spawn(i32 0, %struct.wTrie* %32, i32 %34, i32 0, i32* null, i32 0)
store %struct.wTrie* %35, %struct.wTrie** %8
%36 = load %struct.wTrie*, %struct.wTrie** %8
%37 = load i32*, i32** %6
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %7
%40 = sub nsw i32 %39, 1
%41 = call %struct.wTrie* @wTrie_addnword(%struct.wTrie* %36, i32* %38, i32 %40)
store %struct.wTrie* %41, %struct.wTrie** %4
br label %47
42: ; preds = %28, %23
%43 = load %struct.wTrie*, %struct.wTrie** %5
%44 = load i32*, i32** %6
%45 = load i32, i32* %44
%46 = call %struct.wTrie* @wTrie_spawn(i32 0, %struct.wTrie* %43, i32 %45, i32 1, i32* null, i32 0)
store %struct.wTrie* %46, %struct.wTrie** %4
br label %47
47: ; preds = %42, %31, %22, %14
%48 = load %struct.wTrie*, %struct.wTrie** %4
ret %struct.wTrie* %48
}

LLVM IR (-O2):
%struct.wTrie = type { i32 }
@errno = global i32 0
define %struct.wTrie* @wTrie_addnword(%struct.wTrie* %0, i32* %1, i32 %2) {
%4 = icmp ne i32* %1, null
%5 = icmp ne %struct.wTrie* %0, null
%6 = and i1 %5, %4
br i1 %6, label %8, label %7
7: ; preds = %23, %3
store i32 347, i32* @errno
br label %29
8: ; preds = %3, %23
%9 = phi i32 [ %25, %23 ], [ %2, %3 ]
%10 = phi i32* [ %18, %23 ], [ %1, %3 ]
%11 = phi %struct.wTrie* [ %24, %23 ], [ %0, %3 ]
%12 = load i32, i32* %10
%13 = icmp ne i32 %12, 0
%14 = icmp sgt i32 %9, 0
%15 = and i1 %14, %13
br i1 %15, label %17, label %16
16: ; preds = %8
store i32 346, i32* @errno
br label %29
17: ; preds = %8
%18 = getelementptr inbounds i32, i32* %10, i64 1
%19 = load i32, i32* %18
%20 = icmp ne i32 %19, 0
%21 = icmp ugt i32 %9, 1
%22 = and i1 %21, %20
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = tail call %struct.wTrie* @wTrie_spawn(i32 0, %struct.wTrie* %11, i32 %12, i32 0, i32* null, i32 0)
%25 = add nsw i32 %9, -1
%26 = icmp eq %struct.wTrie* %24, null
br i1 %26, label %7, label %8
27: ; preds = %17
%28 = tail call %struct.wTrie* @wTrie_spawn(i32 0, %struct.wTrie* %11, i32 %12, i32 1, i32* null, i32 0)
br label %29
29: ; preds = %27, %16, %7
%30 = phi %struct.wTrie* [ %28, %27 ], [ null, %16 ], [ null, %7 ]
ret %struct.wTrie* %30
}