#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*/ strcmp(char const *, char *);
const char *bmy_cookie_check_host(const char *host) {
  if (host == NULL)
    return host;
  if (!strcmp(host, "bbs.xjtu6.edu.cn"))
    return "bbs.xjtu6.edu.cn";
  return (!strcmp(host, "bbs.xjtu.edu.cn")) ? "bbs.xjtu.edu.cn" : NULL;
}


x86 assembly (clang, -O0):
<bmy_cookie_check_host>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <bmy_cookie_check_host+0x24>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <bmy_cookie_check_host+0x7a>
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115d <bmy_cookie_check_host+0x4d>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <bmy_cookie_check_host+0x7a>
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %dl
xor    $0xff,%dl
xor    %eax,%eax
lea    0xe92(%rip),%rcx
test   $0x1,%dl
cmovne %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmy_cookie_check_host>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     114c <bmy_cookie_check_host+0x3c>
mov    %rdi,%r14
lea    0xedc(%rip),%rbx
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     114e <bmy_cookie_check_host+0x3e>
lea    0xeda(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
cmove  %r15,%rbx
jmp    114e <bmy_cookie_check_host+0x3e>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"bbs.xjtu6.edu.cn\00"
@.str.1 = [16 x i8] c"bbs.xjtu.edu.cn\00"
define i8* @bmy_cookie_check_host(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i8*, i8** %3
store i8* %7, i8** %2
br label %20
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* null
store i8* %19, i8** %2
br label %20
20: ; preds = %13, %12, %6
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [17 x i8] c"bbs.xjtu6.edu.cn\00"
@.str.1 = [16 x i8] c"bbs.xjtu.edu.cn\00"
define i8* @bmy_cookie_check_host(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* null
br label %10
10: ; preds = %3, %1, %6
%11 = phi i8* [ %9, %6 ], [ null, %1 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), %3 ]
ret i8* %11
}