#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 is_global_vg(char const *);
int is_orphan_vg(char const *);
int strcmp(char const *, char const *);
int _vgname_order_correct(char const *vgname1, char const *vgname2) {
  int tmp;
  int tmp___0;
  int tmp___1;
  int tmp___2;
  int tmp___3;
  {
    { tmp = is_global_vg(vgname1); }
    if (tmp) {
      return (1);
    } else {
    }
    { tmp___0 = is_global_vg(vgname2); }
    if (tmp___0) {
      return (0);
    } else {
    }
    { tmp___1 = is_orphan_vg(vgname1); }
    if (tmp___1) {
      return (0);
    } else {
    }
    { tmp___2 = is_orphan_vg(vgname2); }
    if (tmp___2) {
      return (1);
    } else {
    }
    { tmp___3 = strcmp(vgname1, vgname2); }
    if (tmp___3 < 0) {
      return (1);
    } else {
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<_vgname_order_correct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <is_global_vg@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1162 <_vgname_order_correct+0x32>
movl   $0x1,-0x4(%rbp)
jmp    120e <_vgname_order_correct+0xde>
jmp    1167 <_vgname_order_correct+0x37>
mov    -0x18(%rbp),%rdi
call   1040 <is_global_vg@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1189 <_vgname_order_correct+0x59>
movl   $0x0,-0x4(%rbp)
jmp    120e <_vgname_order_correct+0xde>
jmp    118e <_vgname_order_correct+0x5e>
mov    -0x10(%rbp),%rdi
call   1050 <is_orphan_vg@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11b0 <_vgname_order_correct+0x80>
movl   $0x0,-0x4(%rbp)
jmp    120e <_vgname_order_correct+0xde>
jmp    11b5 <_vgname_order_correct+0x85>
mov    -0x18(%rbp),%rdi
call   1050 <is_orphan_vg@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     11d7 <_vgname_order_correct+0xa7>
movl   $0x1,-0x4(%rbp)
jmp    120e <_vgname_order_correct+0xde>
jmp    11dc <_vgname_order_correct+0xac>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1202 <_vgname_order_correct+0xd2>
movl   $0x1,-0x4(%rbp)
jmp    120e <_vgname_order_correct+0xde>
jmp    1207 <_vgname_order_correct+0xd7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vgname_order_correct>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <is_global_vg@plt>
mov    $0x1,%ebp
test   %eax,%eax
jne    1183 <_vgname_order_correct+0x53>
mov    %r14,%rdi
call   1040 <is_global_vg@plt>
xor    %ebp,%ebp
test   %eax,%eax
jne    1183 <_vgname_order_correct+0x53>
mov    %rbx,%rdi
call   1050 <is_orphan_vg@plt>
test   %eax,%eax
jne    1183 <_vgname_order_correct+0x53>
mov    %r14,%rdi
call   1050 <is_orphan_vg@plt>
mov    $0x1,%ebp
test   %eax,%eax
jne    1183 <_vgname_order_correct+0x53>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
mov    %eax,%ebp
shr    $0x1f,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_vgname_order_correct(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%11 = load i8*, i8** %4
%12 = call i32 @is_global_vg(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 1, i32* %3
br label %47
16: ; preds = %2
br label %17
17: ; preds = %16
%18 = load i8*, i8** %5
%19 = call i32 @is_global_vg(i8* %18)
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 0, i32* %3
br label %47
23: ; preds = %17
br label %24
24: ; preds = %23
%25 = load i8*, i8** %4
%26 = call i32 @is_orphan_vg(i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 0, i32* %3
br label %47
30: ; preds = %24
br label %31
31: ; preds = %30
%32 = load i8*, i8** %5
%33 = call i32 @is_orphan_vg(i8* %32)
store i32 %33, i32* %9
%34 = load i32, i32* %9
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %31
store i32 1, i32* %3
br label %47
37: ; preds = %31
br label %38
38: ; preds = %37
%39 = load i8*, i8** %4
%40 = load i8*, i8** %5
%41 = call i32 @strcmp(i8* %39, i8* %40)
store i32 %41, i32* %10
%42 = load i32, i32* %10
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 1, i32* %3
br label %47
45: ; preds = %38
br label %46
46: ; preds = %45
store i32 0, i32* %3
br label %47
47: ; preds = %46, %44, %36, %29, %22, %15
%48 = load i32, i32* %3
ret i32 %48
}

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