#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__ strchr(char *, char const);
int __config_name_compare(const char *a, const char *b) {
  const char *p, *q;
  for (p = a, q = b;; p++, q++) {
    int pd = ((!*p) || strchr(":/", *p));
    int qd = ((!*q) || strchr(":/", *q));
    if (pd && qd)
      break;
    else if (pd)
      return (-1);
    else if (qd)
      return (1);
    else if (*p < *q)
      return (-1);
    else if (*p > *q)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<__config_name_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,(%rcx)
mov    %al,-0x31(%rbp)
je     115f <__config_name_compare+0x4f>
mov    -0x20(%rbp),%rax
lea    0xeb3(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,(%rcx)
mov    %al,-0x32(%rbp)
je     1199 <__config_name_compare+0x89>
mov    -0x28(%rbp),%rax
lea    0xe79(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x32(%rbp)
mov    -0x32(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     11bd <__config_name_compare+0xad>
cmpl   $0x0,-0x30(%rbp)
je     11bd <__config_name_compare+0xad>
jmp    1263 <__config_name_compare+0x153>
cmpl   $0x0,-0x2c(%rbp)
je     11d3 <__config_name_compare+0xc3>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <__config_name_compare+0x15a>
cmpl   $0x0,-0x30(%rbp)
je     11e9 <__config_name_compare+0xd9>
movl   $0x1,-0x4(%rbp)
jmp    126a <__config_name_compare+0x15a>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jge    120b <__config_name_compare+0xfb>
movl   $0xffffffff,-0x4(%rbp)
jmp    126a <__config_name_compare+0x15a>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jle    122d <__config_name_compare+0x11d>
movl   $0x1,-0x4(%rbp)
jmp    126a <__config_name_compare+0x15a>
jmp    1232 <__config_name_compare+0x122>
jmp    1237 <__config_name_compare+0x127>
jmp    123c <__config_name_compare+0x12c>
jmp    1241 <__config_name_compare+0x131>
jmp    1246 <__config_name_compare+0x136>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1130 <__config_name_compare+0x20>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__config_name_compare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
xor    %ebp,%ebp
lea    0xed6(%rip),%r15
nopw   0x0(%rax,%rax,1)
movzbl (%r12,%rbp,1),%eax
mov    $0x1,%bl
mov    $0x1,%r13b
test   %al,%al
je     1150 <__config_name_compare+0x40>
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
setne  %r13b
movzbl (%r14,%rbp,1),%eax
test   %al,%al
je     1184 <__config_name_compare+0x74>
movsbl %al,%esi
mov    %r15,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
setne  %bl
mov    %r13d,%eax
or     %bl,%al
jne    1184 <__config_name_compare+0x74>
movzbl (%r14,%rbp,1),%eax
cmp    %al,(%r12,%rbp,1)
jl     11a1 <__config_name_compare+0x91>
jg     11a8 <__config_name_compare+0x98>
add    $0x1,%rbp
jmp    1130 <__config_name_compare+0x20>
mov    %r13d,%eax
xor    $0x1,%al
movzbl %al,%eax
lea    (%rax,%rax,1),%ecx
add    $0xffffffff,%ecx
xor    %eax,%eax
test   %bl,%bl
cmove  %ecx,%eax
test   %r13b,%r13b
cmove  %ecx,%eax
jmp    11ad <__config_name_compare+0x9d>
mov    $0xffffffff,%eax
jmp    11ad <__config_name_compare+0x9d>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c":/\00"
define i32 @__config_name_compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%10 = load i8*, i8** %4
store i8* %10, i8** %6
%11 = load i8*, i8** %5
store i8* %11, i8** %7
br label %12
12: ; preds = %72, %2
%13 = load i8*, i8** %6
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %18)
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %16, %12
%22 = phi i1 [ true, %12 ], [ %20, %16 ]
%23 = zext i1 %22 to i32
store i32 %23, i32* %8
%24 = load i8*, i8** %7
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %21
%28 = load i8*, i8** %7
%29 = load i8, i8* %28
%30 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %29)
%31 = icmp ne i64 %30, 0
br label %32
32: ; preds = %27, %21
%33 = phi i1 [ true, %21 ], [ %31, %27 ]
%34 = zext i1 %33 to i32
store i32 %34, i32* %9
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i32, i32* %9
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %37
br label %77
41: ; preds = %37, %32
%42 = load i32, i32* %8
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 -1, i32* %3
br label %78
45: ; preds = %41
%46 = load i32, i32* %9
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 1, i32* %3
br label %78
49: ; preds = %45
%50 = load i8*, i8** %6
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = load i8*, i8** %7
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp slt i32 %52, %55
br i1 %56, label %57, label %58
57: ; preds = %49
store i32 -1, i32* %3
br label %78
58: ; preds = %49
%59 = load i8*, i8** %6
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = load i8*, i8** %7
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp sgt i32 %61, %64
br i1 %65, label %66, label %67
66: ; preds = %58
store i32 1, i32* %3
br label %78
67: ; preds = %58
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
%73 = load i8*, i8** %6
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %6
%75 = load i8*, i8** %7
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %7
br label %12
77: ; preds = %40
store i32 0, i32* %3
br label %78
78: ; preds = %77, %66, %57, %48, %44
%79 = load i32, i32* %3
ret i32 %79
}

LLVM IR (-O2):
@.str = [3 x i8] c":/\00"
define i32 @__config_name_compare(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %30, %2
%4 = phi i8* [ %1, %2 ], [ %32, %30 ]
%5 = phi i8* [ %0, %2 ], [ %31, %30 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%10 = icmp ne i64 %9, 0
br label %11
11: ; preds = %8, %3
%12 = phi i1 [ true, %3 ], [ %10, %8 ]
%13 = load i8, i8* %4
%14 = icmp eq i8 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %11
%16 = tail call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %13)
%17 = icmp ne i64 %16, 0
%18 = select i1 %12, i1 true, i1 %17
br i1 %18, label %25, label %19
19: ; preds = %15
%20 = load i8, i8* %5
%21 = load i8, i8* %4
%22 = icmp slt i8 %20, %21
br i1 %22, label %33, label %23
23: ; preds = %19
%24 = icmp sgt i8 %20, %21
br i1 %24, label %33, label %30
25: ; preds = %11, %15
%26 = phi i1 [ %17, %15 ], [ true, %11 ]
%27 = select i1 %12, i1 %26, i1 false
%28 = select i1 %12, i32 -1, i32 1
%29 = select i1 %27, i32 0, i32 %28
br label %33
30: ; preds = %23
%31 = getelementptr inbounds i8, i8* %5, i64 1
%32 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
33: ; preds = %23, %19, %25
%34 = phi i32 [ %29, %25 ], [ 1, %23 ], [ -1, %19 ]
ret i32 %34
}