#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 strcmp(char const *, char const *);
__attribute__((always_)) int fcitx_utils_strcmp0(const char *a, const char *b) {
  if (a == NULL && b == NULL)
    return 0;
  if (a == NULL && b)
    return -1;
  if (a && b == NULL)
    return 1;
  return strcmp(a, b);
}


x86 assembly (clang, -O0):
<fcitx_utils_strcmp0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <fcitx_utils_strcmp0+0x32>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <fcitx_utils_strcmp0+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1196 <fcitx_utils_strcmp0+0x86>
cmpq   $0x0,-0x10(%rbp)
jne    1164 <fcitx_utils_strcmp0+0x54>
cmpq   $0x0,-0x18(%rbp)
je     1164 <fcitx_utils_strcmp0+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    1196 <fcitx_utils_strcmp0+0x86>
cmpq   $0x0,-0x10(%rbp)
je     1186 <fcitx_utils_strcmp0+0x76>
cmpq   $0x0,-0x18(%rbp)
jne    1186 <fcitx_utils_strcmp0+0x76>
movl   $0x1,-0x4(%rbp)
jmp    1196 <fcitx_utils_strcmp0+0x86>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcitx_utils_strcmp0>:
xor    %eax,%eax
mov    %rdi,%rcx
or     %rsi,%rcx
je     1138 <fcitx_utils_strcmp0+0x28>
test   %rdi,%rdi
jne    1129 <fcitx_utils_strcmp0+0x19>
mov    $0xffffffff,%eax
test   %rsi,%rsi
jne    1138 <fcitx_utils_strcmp0+0x28>
test   %rdi,%rdi
je     1139 <fcitx_utils_strcmp0+0x29>
mov    $0x1,%eax
test   %rsi,%rsi
jne    1139 <fcitx_utils_strcmp0+0x29>
ret
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @fcitx_utils_strcmp0(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 0, i32* %3
br label %30
12: ; preds = %8, %2
%13 = load i8*, i8** %4
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 -1, i32* %3
br label %30
19: ; preds = %15, %12
%20 = load i8*, i8** %4
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i8*, i8** %5
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 1, i32* %3
br label %30
26: ; preds = %22, %19
%27 = load i8*, i8** %4
%28 = load i8*, i8** %5
%29 = call i32 @strcmp(i8* %27, i8* %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %26, %25, %18, %11
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @fcitx_utils_strcmp0(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = icmp ne i8* %1, null
%8 = and i1 %3, %7
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = icmp ne i8* %0, null
%11 = and i1 %10, %4
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
br label %14
14: ; preds = %9, %6, %2, %12
%15 = phi i32 [ %13, %12 ], [ 0, %2 ], [ -1, %6 ], [ 1, %9 ]
ret i32 %15
}