#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__ is_global_vg(char const *);
scalar_t__ is_orphan_vg(char const *);
scalar_t__ strcmp(char const *, char const *);
int _vgname_order_correct(const char *vgname1, const char *vgname2) {
  if (is_global_vg(vgname1))
    return 1;
  if (is_global_vg(vgname2))
    return 0;
  if (is_orphan_vg(vgname1))
    return 0;
  if (is_orphan_vg(vgname2))
    return 1;
  if (strcmp(vgname1, vgname2) < 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<_vgname_order_correct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <is_global_vg@plt>
cmp    $0x0,%rax
je     115f <_vgname_order_correct+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <_vgname_order_correct+0xb6>
mov    -0x18(%rbp),%rdi
call   1040 <is_global_vg@plt>
cmp    $0x0,%rax
je     117e <_vgname_order_correct+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <_vgname_order_correct+0xb6>
mov    -0x10(%rbp),%rdi
call   1050 <is_orphan_vg@plt>
cmp    $0x0,%rax
je     119d <_vgname_order_correct+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <_vgname_order_correct+0xb6>
mov    -0x18(%rbp),%rdi
call   1050 <is_orphan_vg@plt>
cmp    $0x0,%rax
je     11bc <_vgname_order_correct+0x8c>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <_vgname_order_correct+0xb6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jge    11df <_vgname_order_correct+0xaf>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <_vgname_order_correct+0xb6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vgname_order_correct>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <is_global_vg@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    118a <_vgname_order_correct+0x5a>
mov    %r14,%rdi
call   1040 <is_global_vg@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    118a <_vgname_order_correct+0x5a>
mov    %r15,%rdi
call   1050 <is_orphan_vg@plt>
test   %rax,%rax
jne    118a <_vgname_order_correct+0x5a>
mov    %r14,%rdi
call   1050 <is_orphan_vg@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    118a <_vgname_order_correct+0x5a>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
mov    %rax,%rbx
shr    $0x3f,%rbx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @_vgname_order_correct(i8* %0, i8* %1) {
%3 = tail call i64 @is_global_vg(i8* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %2
%6 = tail call i64 @is_global_vg(i8* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = tail call i64 @is_orphan_vg(i8* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = tail call i64 @is_orphan_vg(i8* %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = tail call i64 @strcmp(i8* %0, i8* %1)
%16 = lshr i64 %15, 63
%17 = trunc i64 %16 to i32
br label %18
18: ; preds = %14, %11, %8, %5, %2
%19 = phi i32 [ 1, %2 ], [ 0, %5 ], [ 0, %8 ], [ 1, %11 ], [ %17, %14 ]
ret i32 %19
}