#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_addword(struct wTrie *wtr, const wchar_t *wstring) {
  if (!((wstring && wtr))) {
    errno = 347;
    return NULL;
  };
  if (!(*wstring)) {
    errno = 346;
    return NULL;
  };
  if (*(wstring + 1) != L'\0') {
    struct wTrie *nwtr = wTrie_spawn(0, wtr, *wstring, 0, NULL, 0);
    return wTrie_addword(nwtr, wstring + 1);
  } else
    return wTrie_spawn(0, wtr, *wstring, 1, NULL, 0);
}


x86 assembly (clang, -O0):
<wTrie_addword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1146 <wTrie_addword+0x26>
cmpq   $0x0,-0x10(%rbp)
jne    1160 <wTrie_addword+0x40>
mov    0x2e93(%rip),%rax
movl   $0x15b,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    11f3 <wTrie_addword+0xd3>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1187 <wTrie_addword+0x67>
mov    0x2e6c(%rip),%rax
movl   $0x15a,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    11f3 <wTrie_addword+0xd3>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     11d0 <wTrie_addword+0xb0>
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,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1040 <wTrie_addword@plt>
mov    %rax,-0x8(%rbp)
jmp    11f3 <wTrie_addword+0xd3>
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    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wTrie_addword>:
push   %rbx
test   %rdi,%rdi
je     1157 <wTrie_addword+0x47>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1157 <wTrie_addword+0x47>
mov    %rdi,%rax
add    $0x4,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x4(%rbx),%edx
test   %edx,%edx
je     1166 <wTrie_addword+0x56>
cmpl   $0x0,(%rbx)
je     1177 <wTrie_addword+0x67>
xor    %edi,%edi
mov    %rax,%rsi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <wTrie_spawn@plt>
add    $0x4,%rbx
test   %rax,%rax
jne    1130 <wTrie_addword+0x20>
mov    0x2e82(%rip),%rax
movl   $0x15b,(%rax)
jmp    1173 <wTrie_addword+0x63>
mov    0x2e73(%rip),%rax
movl   $0x15a,(%rax)
xor    %eax,%eax
pop    %rbx
ret
xor    %edi,%edi
mov    %rax,%rsi
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
pop    %rbx
jmp    1030 <wTrie_spawn@plt>

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

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