#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 dumbtts_conf {
  int dummy;
};

/* Variables and functions */
int dumbtts_WCharString(struct dumbtts_conf *, int, char *, int, int, int *);
int get_unichar(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char *, char *);
int dumbtts_CharString(struct dumbtts_conf *conf, char *ch, char *outbuf,
                       int len, int capMode, int *isCap) {
  wchar_t wc;
  if (!strcmp(ch, "space"))
    wc = 32;
  else
    wc = get_unichar(ch, NULL, 0);
  if (wc)
    return dumbtts_WCharString(conf, wc, outbuf, len, capMode, isCap);
  return -1;
}


x86 assembly (clang, -O0):
<dumbtts_CharString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1174 <dumbtts_CharString+0x44>
movl   $0x20,-0x34(%rbp)
jmp    1186 <dumbtts_CharString+0x56>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <get_unichar@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     11b3 <dumbtts_CharString+0x83>
mov    -0x10(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x30(%rbp),%r9
call   1050 <dumbtts_WCharString@plt>
mov    %eax,-0x4(%rbp)
jmp    11ba <dumbtts_CharString+0x8a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumbtts_CharString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xeac(%rip),%rsi
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1186 <dumbtts_CharString+0x56>
mov    %rbp,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <get_unichar@plt>
mov    %eax,%esi
test   %eax,%eax
jne    118b <dumbtts_CharString+0x5b>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x20,%esi
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <dumbtts_WCharString@plt>

LLVM IR (-O0):
%struct.dumbtts_conf = type { i32 }
@.str = [6 x i8] c"space\00"
define i32 @dumbtts_CharString(%struct.dumbtts_conf* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32* %5) {
%7 = alloca i32
%8 = alloca %struct.dumbtts_conf*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32
store %struct.dumbtts_conf* %0, %struct.dumbtts_conf** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32* %5, i32** %13
%15 = load i8*, i8** %9
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %6
store i32 32, i32* %14
br label %22
19: ; preds = %6
%20 = load i8*, i8** %9
%21 = call i32 @get_unichar(i8* %20, i32* null, i32 0)
store i32 %21, i32* %14
br label %22
22: ; preds = %19, %18
%23 = load i32, i32* %14
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %22
%26 = load %struct.dumbtts_conf*, %struct.dumbtts_conf** %8
%27 = load i32, i32* %14
%28 = load i8*, i8** %10
%29 = load i32, i32* %11
%30 = load i32, i32* %12
%31 = load i32*, i32** %13
%32 = call i32 @dumbtts_WCharString(%struct.dumbtts_conf* %26, i32 %27, i8* %28, i32 %29, i32 %30, i32* %31)
store i32 %32, i32* %7
br label %34
33: ; preds = %22
store i32 -1, i32* %7
br label %34
34: ; preds = %33, %25
%35 = load i32, i32* %7
ret i32 %35
}

LLVM IR (-O2):
%struct.dumbtts_conf = type { i32 }
@.str = [6 x i8] c"space\00"
define i32 @dumbtts_CharString(%struct.dumbtts_conf* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32* %5) {
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 @get_unichar(i8* %1, i32* null, i32 0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6, %9
%13 = phi i32 [ %10, %9 ], [ 32, %6 ]
%14 = tail call i32 @dumbtts_WCharString(%struct.dumbtts_conf* %0, i32 %13, i8* %2, i32 %3, i32 %4, i32* %5)
br label %15
15: ; preds = %9, %12
%16 = phi i32 [ %14, %12 ], [ -1, %9 ]
ret i32 %16
}