#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 */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
scalar_t__ strcmp(char const *, char const *);
char *textdomain(const char *domainname) {
  static const char default_str[] = "messages";
  if (domainname && *domainname && strcmp(domainname, default_str)) {
    errno = EINVAL;
    return NULL;
  }
  return (char *)default_str;
}


x86 assembly (clang, -O0):
<textdomain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1170 <textdomain+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1170 <textdomain+0x60>
mov    -0x10(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1170 <textdomain+0x60>
mov    0x2e80(%rip),%rax
mov    (%rax),%ecx
mov    0x2e7f(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    117b <textdomain+0x6b>
lea    0xe89(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<textdomain>:
push   %rbx
lea    0xee8(%rip),%rbx
test   %rdi,%rdi
je     114a <textdomain+0x3a>
cmpb   $0x0,(%rdi)
je     114a <textdomain+0x3a>
lea    0xed7(%rip),%rbx
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114a <textdomain+0x3a>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    0x2e9a(%rip),%rcx
mov    %eax,(%rcx)
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@textdomain.default_str = internal constant [9 x i8] c"messages\00"
@EINVAL = global i32 0
@errno = global i32 0
define i8* @textdomain(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %17
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @textdomain.default_str, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* @EINVAL
store i32 %16, i32* @errno
store i8* null, i8** %2
br label %18
17: ; preds = %11, %6, %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @textdomain.default_str, i64 0, i64 0), i8** %2
br label %18
18: ; preds = %17, %15
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@textdomain.default_str = internal constant [9 x i8] c"messages\00"
@EINVAL = global i32 0
@errno = global i32 0
define i8* @textdomain(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @textdomain.default_str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = load i32, i32* @EINVAL
store i32 %10, i32* @errno
br label %11
11: ; preds = %1, %3, %6, %9
%12 = phi i8* [ null, %9 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @textdomain.default_str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @textdomain.default_str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @textdomain.default_str, i64 0, i64 0), %1 ]
ret i8* %12
}