#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 */
struct maven_version {
  int dummy;
};

/* Variables and functions */
int mv_compare(struct maven_version *, struct maven_version *);
int /*<<< orphan*/ mv_free(struct maven_version *);
struct maven_version *mv_parse(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Usage: compare <version1> <version2>\n");
    return 1;
  }
  struct maven_version *v1 = mv_parse(argv[1]);
  struct maven_version *v2 = mv_parse(argv[2]);
  printf("%d\n", mv_compare(v1, v2));
  mv_free(v1);
  mv_free(v2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117a <main+0x3a>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d2 <main+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <mv_parse@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <mv_parse@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <mv_compare@plt>
mov    %eax,%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <mv_free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <mv_free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%edi
jne    11a4 <main+0x54>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1070 <mv_parse@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1070 <mv_parse@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <mv_compare@plt>
lea    0xe79(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   1030 <mv_free@plt>
mov    %r15,%rdi
call   1030 <mv_free@plt>
jmp    11b5 <main+0x65>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.maven_version = type { i32 }
@.str = [38 x i8] c"Usage: compare <version1> <version2>\0A\00"
@.str.1 = [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 %struct.maven_version*
%7 = alloca %struct.maven_version*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %29
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call %struct.maven_version* @mv_parse(i8* %15)
store %struct.maven_version* %16, %struct.maven_version** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call %struct.maven_version* @mv_parse(i8* %19)
store %struct.maven_version* %20, %struct.maven_version** %7
%21 = load %struct.maven_version*, %struct.maven_version** %6
%22 = load %struct.maven_version*, %struct.maven_version** %7
%23 = call i32 @mv_compare(%struct.maven_version* %21, %struct.maven_version* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load %struct.maven_version*, %struct.maven_version** %6
%26 = call i32 @mv_free(%struct.maven_version* %25)
%27 = load %struct.maven_version*, %struct.maven_version** %7
%28 = call i32 @mv_free(%struct.maven_version* %27)
store i32 0, i32* %3
br label %29
29: ; preds = %12, %10
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
%struct.maven_version = type { i32 }
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [37 x i8] c"Usage: compare <version1> <version2>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %17
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call %struct.maven_version* @mv_parse(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call %struct.maven_version* @mv_parse(i8* %11)
%13 = tail call i32 @mv_compare(%struct.maven_version* %9, %struct.maven_version* %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = tail call i32 @mv_free(%struct.maven_version* %9)
%16 = tail call i32 @mv_free(%struct.maven_version* %12)
br label %17
17: ; preds = %6, %4
%18 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %18
}