#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 */
scalar_t__ strcmp(char const *, char const *);
int comp(const char **a, const char **b) {
  if (strcmp(*a, *b) == 0)
    return 0;
  if (strcmp(*a, *b) > 0)
    return 1;
  if (strcmp(*a, *b) < 0)
    return -1;
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1149 <comp+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1196 <comp+0x86>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jle    1172 <comp+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1196 <comp+0x86>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jge    1196 <comp+0x86>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    (%rsi),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1154 <comp+0x44>
mov    (%rbx),%rdi
mov    (%r14),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jg     1156 <comp+0x46>
mov    (%rbx),%rdi
mov    (%r14),%rsi
call   1030 <strcmp@plt>
mov    $0xffffffff,%eax
jmp    1156 <comp+0x46>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @comp(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 = load i8*, i8** %6
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %8
%10 = call i64 @strcmp(i8* %7, i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %29
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %15, i8* %17)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %13
store i32 1, i32* %3
br label %29
21: ; preds = %13
%22 = load i8**, i8*** %4
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %23, i8* %25)
%27 = icmp slt i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %21
store i32 -1, i32* %3
br label %29
29: ; preds = %12, %20, %28, %21
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @comp(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i64 @strcmp(i8* %3, i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %2
%8 = load i8*, i8** %0
%9 = load i8*, i8** %1
%10 = tail call i64 @strcmp(i8* %8, i8* %9)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = load i8*, i8** %0
%14 = load i8*, i8** %1
%15 = tail call i64 @strcmp(i8* %13, i8* %14)
br label %16
16: ; preds = %12, %7, %2
%17 = phi i32 [ 0, %2 ], [ 1, %7 ], [ -1, %12 ]
ret i32 %17
}