#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 alpm_pkg_vercmp(char const *, char const *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  const char *s1 = "";
  const char *s2 = "";
  int ret;
  if (argc == 1) {
    usage();
    return (2);
  }
  if (argc > 1 &&
      (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0 ||
       strcmp(argv[1], "--usage") == 0)) {
    usage();
    return (0);
  }
  if (argc > 2) {
    s2 = argv[2];
  }
  if (argc > 1) {
    s1 = argv[1];
  }
  ret = alpm_pkg_vercmp(s1, s2);
  printf("%d\n", ret);
  return (ret);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb8(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1189 <main+0x49>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x2,-0x4(%rbp)
jmp    1251 <main+0x111>
cmpl   $0x1,-0x8(%rbp)
jle    1200 <main+0xc0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11ed <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe43(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11ed <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1200 <main+0xc0>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1251 <main+0x111>
cmpl   $0x2,-0x8(%rbp)
jle    1216 <main+0xd6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    122c <main+0xec>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <alpm_pkg_vercmp@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xdcc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1156 <main+0x16>
xor    %eax,%eax
call   1060 <usage@plt>
mov    $0x2,%ebx
jmp    11d1 <main+0x91>
jle    11a7 <main+0x67>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <main+0x88>
mov    0x8(%rbx),%rdi
lea    0xe86(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <main+0x88>
mov    0x8(%rbx),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c8 <main+0x88>
cmp    $0x3,%ebp
jb     11da <main+0x9a>
mov    0x10(%rbx),%rsi
jmp    11e1 <main+0xa1>
lea    0xe67(%rip),%rsi
mov    %rsi,%rdi
call   1050 <alpm_pkg_vercmp@plt>
mov    %eax,%ebx
lea    0xe53(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    11d1 <main+0x91>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <usage@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe34(%rip),%rsi
mov    0x8(%rbx),%rdi
jmp    11b1 <main+0x71>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.3 = [8 x i8] c"--usage\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %7
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @usage()
store i32 2, i32* %3
br label %57
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %36
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %34, label %22
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %28, %22, %16
%35 = call i32 (...) @usage()
store i32 0, i32* %3
br label %57
36: ; preds = %28, %13
%37 = load i32, i32* %4
%38 = icmp sgt i32 %37, 2
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
store i8* %42, i8** %7
br label %43
43: ; preds = %39, %36
%44 = load i32, i32* %4
%45 = icmp sgt i32 %44, 1
br i1 %45, label %46, label %50
46: ; preds = %43
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
store i8* %49, i8** %6
br label %50
50: ; preds = %46, %43
%51 = load i8*, i8** %6
%52 = load i8*, i8** %7
%53 = call i32 @alpm_pkg_vercmp(i8* %51, i8* %52)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %8
store i32 %56, i32* %3
br label %57
57: ; preds = %50, %34, %11
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
@.str.3 = [8 x i8] c"--usage\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %36
6: ; preds = %2
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %31
8: ; preds = %6
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %8
%14 = load i8*, i8** %9
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8*, i8** %9
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17, %13, %8
%22 = tail call i32 (...) @usage()
br label %36
23: ; preds = %17
%24 = icmp ugt i32 %0, 2
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
br label %28
28: ; preds = %25, %23
%29 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %23 ], [ %27, %25 ]
%30 = load i8*, i8** %9
br label %31
31: ; preds = %6, %28
%32 = phi i8* [ %29, %28 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %6 ]
%33 = phi i8* [ %30, %28 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %6 ]
%34 = tail call i32 @alpm_pkg_vercmp(i8* %33, i8* %32)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %31, %21, %4
%37 = phi i32 [ 2, %4 ], [ 0, %21 ], [ %34, %31 ]
ret i32 %37
}