#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 __pu_test_compare_kver(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Usage: %s <version-str> <version-str>\n", argv[0]);
    return -1;
  }
  switch (__pu_test_compare_kver(argv[1], argv[2])) {
  case 0:
    return 0;
  case -1:
    return 1;
  case 1:
    return 2;
  default:
    return -1;
  }
}


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     115f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cf <main+0xaf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x10(%rax),%rsi
call   1040 <__pu_test_compare_kver@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0xffffffff,%eax
je     11b0 <main+0x90>
jmp    1183 <main+0x63>
mov    -0x14(%rbp),%eax
test   %eax,%eax
je     11a4 <main+0x84>
jmp    1193 <main+0x73>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     11bc <main+0x9c>
jmp    11c8 <main+0xa8>
movl   $0x0,-0x4(%rbp)
jmp    11cf <main+0xaf>
movl   $0x1,-0x4(%rbp)
jmp    11cf <main+0xaf>
movl   $0x2,-0x4(%rbp)
jmp    11cf <main+0xaf>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jne    1151 <main+0x31>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <__pu_test_compare_kver@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0xffffffff,%eax
cmp    $0x2,%ecx
ja     114f <main+0x2f>
movslq %ecx,%rax
lea    0xedc(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
mov    (%rsi),%rsi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Usage: %s <version-str> <version-str>\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 ne i32 %6, 3
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 -1, i32* %3
br label %25
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @__pu_test_compare_kver(i8* %16, i8* %19)
switch i32 %20, label %24 [
i32 0, label %21
i32 -1, label %22
i32 1, label %23
]
21: ; preds = %13
store i32 0, i32* %3
br label %25
22: ; preds = %13
store i32 1, i32* %3
br label %25
23: ; preds = %13
store i32 2, i32* %3
br label %25
24: ; preds = %13
store i32 -1, i32* %3
br label %25
25: ; preds = %24, %23, %22, %21, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [39 x i8] c"Usage: %s <version-str> <version-str>\0A\00"
@switch.table.main = [3 x i32] [i32 1, i32 0, i32 2]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %19
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @__pu_test_compare_kver(i8* %9, i8* %11)
%13 = add i32 %12, 1
%14 = icmp ult i32 %13, 3
br i1 %14, label %15, label %19
15: ; preds = %7
%16 = sext i32 %13 to i64
%17 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.main, i64 0, i64 %16
%18 = load i32, i32* %17
br label %19
19: ; preds = %7, %15, %4
%20 = phi i32 [ -1, %4 ], [ %18, %15 ], [ -1, %7 ]
ret i32 %20
}