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

/* Variables and functions */
scalar_t__ csr1212_check_minimal_ascii(char const *);
struct csr1212_keyval *csr1212_new_textual_descriptor_leaf(int /*<<< orphan*/,
                                                           int /*<<< orphan*/,
                                                           int /*<<< orphan*/,
                                                           char const *,
                                                           int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s) {
  if (csr1212_check_minimal_ascii(s))
    return NULL;
  return csr1212_new_textual_descriptor_leaf(0, 0, 0, s, strlen(s));
}


x86 assembly (clang, -O0):
<csr1212_new_string_descriptor_leaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <csr1212_check_minimal_ascii@plt>
cmp    $0x0,%rax
je     115c <csr1212_new_string_descriptor_leaf+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1183 <csr1212_new_string_descriptor_leaf+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rcx
mov    %eax,%r8d
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1040 <csr1212_new_textual_descriptor_leaf@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csr1212_new_string_descriptor_leaf>:
push   %rbx
mov    %rdi,%rbx
call   1050 <csr1212_check_minimal_ascii@plt>
test   %rax,%rax
je     1142 <csr1212_new_string_descriptor_leaf+0x12>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %rbx,%rcx
mov    %eax,%r8d
pop    %rbx
jmp    1040 <csr1212_new_textual_descriptor_leaf@plt>

LLVM IR (-O0):
%struct.csr1212_keyval = type { i32 }
define %struct.csr1212_keyval* @csr1212_new_string_descriptor_leaf(i8* %0) {
%2 = alloca %struct.csr1212_keyval*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @csr1212_check_minimal_ascii(i8* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store %struct.csr1212_keyval* null, %struct.csr1212_keyval** %2
br label %13
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = call %struct.csr1212_keyval* @csr1212_new_textual_descriptor_leaf(i32 0, i32 0, i32 0, i8* %9, i32 %11)
store %struct.csr1212_keyval* %12, %struct.csr1212_keyval** %2
br label %13
13: ; preds = %8, %7
%14 = load %struct.csr1212_keyval*, %struct.csr1212_keyval** %2
ret %struct.csr1212_keyval* %14
}

LLVM IR (-O2):
%struct.csr1212_keyval = type { i32 }
define %struct.csr1212_keyval* @csr1212_new_string_descriptor_leaf(i8* %0) {
%2 = tail call i64 @csr1212_check_minimal_ascii(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call %struct.csr1212_keyval* @csr1212_new_textual_descriptor_leaf(i32 0, i32 0, i32 0, i8* %0, i32 %5)
br label %7
7: ; preds = %1, %4
%8 = phi %struct.csr1212_keyval* [ %6, %4 ], [ null, %1 ]
ret %struct.csr1212_keyval* %8
}