#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 /*<<< orphan*/ printf(char *, ...);
extern void ver(int old, int new, int ver) {
  printf("\t");
  if (new != -1 && new == ver)
    printf("New");
  else if (old != -1 && old == ver)
    printf("Old");
  else
    printf("Unknown");
  printf(" version(%d)\n", ver);
}


x86 assembly (clang, -O0):
<ver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
je     1158 <ver+0x48>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1158 <ver+0x48>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <ver+0x84>
cmpl   $0xffffffff,-0x4(%rbp)
je     1181 <ver+0x71>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1181 <ver+0x71>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118f <ver+0x7f>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <ver+0x84>
mov    -0xc(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ver>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x9,%edi
call   1030 <putchar@plt>
cmp    %ebx,%ebp
lea    0xec6(%rip),%rax
lea    0xec3(%rip),%rcx
cmovne %rcx,%rax
cmp    $0xffffffff,%ebp
cmove  %rcx,%rax
cmp    %ebx,%r14d
lea    0xea6(%rip),%rdi
cmovne %rax,%rdi
cmp    $0xffffffff,%r14d
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"New\00"
@.str.2 = [4 x i8] c"Old\00"
@.str.3 = [8 x i8] c"Unknown\00"
@.str.4 = [14 x i8] c" version(%d)\0A\00"
define void @ver(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @putchar(i32 9)
%5 = icmp ne i32 %1, -1
%6 = icmp eq i32 %1, %2
%7 = and i1 %5, %6
%8 = icmp ne i32 %0, -1
%9 = icmp eq i32 %0, %2
%10 = and i1 %8, %9
%11 = select i1 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
%12 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %2)
ret void
}