#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 *);
int linked_list_char_cmp(const void *left, const void *right) {
  int ret;
  if (left == NULL && right == NULL)
    ret = 0;
  else if (left != NULL && right == NULL)
    ret = -1;
  else if (left == NULL && right != NULL)
    ret = 1;
  else
    ret = strcmp((const char *)left, (const char *)right);
  return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @linked_list_char_cmp(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* %0, null
%8 = and i1 %7, %4
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = icmp ne i8* %1, null
%11 = and i1 %3, %10
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
}