#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 */
scalar_t__ strncmp(char const *, char *, int);
int gtxt_richtext_get_delimiter(const char *str) {
  if (str[0] == ' ') {
    return 1;
  } else if (strncmp(str, "\xe3\x80\x80", 3) == 0) {
    return 3;
  } else if (strncmp(str, "\xc2\xa0", 2) == 0) {
    return 2;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<gtxt_richtext_get_delimiter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1138 <gtxt_richtext_get_delimiter+0x28>
movl   $0x1,-0x4(%rbp)
jmp    1195 <gtxt_richtext_get_delimiter+0x85>
mov    -0x10(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1163 <gtxt_richtext_get_delimiter+0x53>
movl   $0x3,-0x4(%rbp)
jmp    1195 <gtxt_richtext_get_delimiter+0x85>
mov    -0x10(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    118e <gtxt_richtext_get_delimiter+0x7e>
movl   $0x2,-0x4(%rbp)
jmp    1195 <gtxt_richtext_get_delimiter+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtxt_richtext_get_delimiter>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
cmpb   $0x20,(%rdi)
je     115a <gtxt_richtext_get_delimiter+0x4a>
mov    %rdi,%r14
lea    0xed8(%rip),%rsi
mov    $0x3,%ebx
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     115a <gtxt_richtext_get_delimiter+0x4a>
lea    0xec1(%rip),%rsi
mov    %r14,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
add    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"\E3\80\80\00"
@.str.1 = [3 x i8] c"\C2\A0\00"
define i32 @gtxt_richtext_get_delimiter(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 32
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 1, i32* %2
br label %21
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 3, i32* %2
br label %21
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 2, i32* %2
br label %21
20: ; preds = %15
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19, %14, %9
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [4 x i8] c"\E3\80\80\00"
@.str.1 = [3 x i8] c"\C2\A0\00"
define i32 @gtxt_richtext_get_delimiter(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 32
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i32 2, i32 0
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %1 ], [ 3, %4 ], [ %10, %7 ]
ret i32 %12
}