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

/* Variables and functions */
char *scols_cell_get_data(struct lidirols_cell *);
int strcmp(char const *, char const *);
int scols_cmpstr_cells(struct lidirols_cell *a, struct lidirols_cell *b,
                       __attribute__((__unused__)) void *data) {
  const char *adata, *bdata;
  if (a == b)
    return 0;
  adata = scols_cell_get_data(a);
  bdata = scols_cell_get_data(b);
  if (adata == NULL && bdata == NULL)
    return 0;
  if (adata == NULL)
    return -1;
  if (bdata == NULL)
    return 1;
  return strcmp(adata, bdata);
}


x86 assembly (clang, -O0):
<scols_cmpstr_cells>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    114e <scols_cmpstr_cells+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <scols_cmpstr_cells+0xa8>
mov    -0x10(%rbp),%rdi
call   1030 <scols_cell_get_data@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <scols_cell_get_data@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    118a <scols_cmpstr_cells+0x6a>
cmpq   $0x0,-0x30(%rbp)
jne    118a <scols_cmpstr_cells+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <scols_cmpstr_cells+0xa8>
cmpq   $0x0,-0x28(%rbp)
jne    11a1 <scols_cmpstr_cells+0x81>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <scols_cmpstr_cells+0xa8>
cmpq   $0x0,-0x30(%rbp)
jne    11b8 <scols_cmpstr_cells+0x98>
movl   $0x1,-0x4(%rbp)
jmp    11c8 <scols_cmpstr_cells+0xa8>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scols_cmpstr_cells>:
push   %r14
push   %rbx
push   %rax
cmp    %rsi,%rdi
je     116e <scols_cmpstr_cells+0x4e>
mov    %rsi,%rbx
call   1030 <scols_cell_get_data@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <scols_cell_get_data@plt>
xor    %edx,%edx
mov    %r14,%rcx
or     %rax,%rcx
sete   %dl
add    $0xffffffff,%edx
mov    $0x1,%ecx
test   %r14,%r14
cmove  %edx,%ecx
je     1170 <scols_cmpstr_cells+0x50>
test   %rax,%rax
je     1170 <scols_cmpstr_cells+0x50>
mov    %r14,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcmp@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.lidirols_cell = type { i32 }
define i32 @scols_cmpstr_cells(%struct.lidirols_cell* %0, %struct.lidirols_cell* %1, i8* nocapture readnone %2) {
%4 = icmp eq %struct.lidirols_cell* %0, %1
br i1 %4, label %17, label %5
5: ; preds = %3
%6 = tail call i8* @scols_cell_get_data(%struct.lidirols_cell* %0)
%7 = tail call i8* @scols_cell_get_data(%struct.lidirols_cell* %1)
%8 = icmp eq i8* %6, null
%9 = icmp eq i8* %7, null
%10 = select i1 %8, i1 %9, i1 false
%11 = xor i1 %10, true
%12 = sext i1 %11 to i32
%13 = select i1 %8, i1 true, i1 %9
%14 = select i1 %8, i32 %12, i32 1
br i1 %13, label %17, label %15
15: ; preds = %5
%16 = tail call i32 @strcmp(i8* %6, i8* %7)
br label %17
17: ; preds = %5, %3, %15
%18 = phi i32 [ %16, %15 ], [ 0, %3 ], [ %14, %5 ]
ret i32 %18
}