#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 get_version_major();
int get_version_minor();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc == 2) {
    if (strncmp(argv[1], "--version", strlen("--version")) == 0 ||
        strncmp(argv[1], "-v", strlen("-v")) == 0) {
      printf("v%d.%d\n", get_version_major(), get_version_minor());
    }
  }
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
jne    11ff <main+0xaf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
lea    0xe7d(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xe6b(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11d8 <main+0x88>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
lea    0xe53(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe41(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11fa <main+0xaa>
mov    $0x0,%al
call   1070 <get_version_major@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1040 <get_version_minor@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
lea    0xe18(%rip),%rdi
call   1060 <printf@plt>
jmp    11ff <main+0xaf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    11c7 <main+0x77>
mov    %rsi,%rbx
mov    0x8(%rsi),%r14
lea    0xe98(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11a7 <main+0x57>
mov    0x8(%rbx),%rbx
lea    0xe7d(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11c7 <main+0x77>
xor    %eax,%eax
call   1070 <get_version_major@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <get_version_minor@plt>
lea    0xe4f(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"--version\00"
@.str.1 = [3 x i8] c"-v\00"
@.str.2 = [8 x i8] c"v%d.%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %27
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %8
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %15, %8
%23 = call i32 (...) @get_version_major()
%24 = call i32 (...) @get_version_minor()
%25 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24)
br label %26
26: ; preds = %22, %15
br label %27
27: ; preds = %26, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"--version\00"
@.str.1 = [3 x i8] c"-v\00"
@.str.2 = [8 x i8] c"v%d.%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = tail call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = load i8*, i8** %5
%12 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %10, %4
%16 = tail call i32 (...) @get_version_major()
%17 = tail call i32 (...) @get_version_minor()
%18 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17)
br label %19
19: ; preds = %10, %15, %2
ret i32 0
}