#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*/ exit(int);
int /*<<< orphan*/ init_pairing_inverse(int *, int);
int /*<<< orphan*/ init_pairing_natural(int *, int);
int /*<<< orphan*/ init_pairing_random(int *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int);
void select_pairing(int *pairing, int N, int argc, char *argv[], int pos) {
  if (argc < pos + 1 || !strncasecmp("rnd", argv[pos], 3)) {
    init_pairing_random(pairing, N);
  } else if (!strncasecmp("nat", argv[pos], 3)) {
    init_pairing_natural(pairing, N);
  } else if (!strncasecmp("inv", argv[pos], 3)) {
    init_pairing_inverse(pairing, N);
  } else {
    printf("Pairing strategy \"%s\" unknown!!! Exiting...\n", argv[pos]);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<select_pairing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jl     11b1 <select_pairing+0x51>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe62(%rip),%rdi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11c2 <select_pairing+0x62>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <init_pairing_random@plt>
jmp    125c <select_pairing+0xfc>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe2f(%rip),%rdi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11f9 <select_pairing+0x99>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <init_pairing_natural@plt>
jmp    1257 <select_pairing+0xf7>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdfc(%rip),%rdi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1230 <select_pairing+0xd0>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <init_pairing_inverse@plt>
jmp    1252 <select_pairing+0xf2>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdc9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    1257 <select_pairing+0xf7>
jmp    125c <select_pairing+0xfc>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_pairing>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    %edx,%r8d
jge    11cb <select_pairing+0x6b>
movslq %r8d,%rax
mov    (%rcx,%rax,8),%r14
lea    0xe84(%rip),%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
test   %eax,%eax
je     11cb <select_pairing+0x6b>
lea    0xe70(%rip),%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
test   %eax,%eax
je     11d9 <select_pairing+0x79>
lea    0xe5c(%rip),%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
test   %eax,%eax
jne    11e7 <select_pairing+0x87>
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <init_pairing_inverse@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <init_pairing_random@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <init_pairing_natural@plt>
lea    0xe1e(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"rnd\00"
@.str.1 = [4 x i8] c"nat\00"
@.str.2 = [4 x i8] c"inv\00"
@.str.3 = [45 x i8] c"Pairing strategy \22%s\22 unknown!!! Exiting...\0A\00"
define void @select_pairing(i32* %0, i32 %1, i32 %2, i8** %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i32 %4, i32* %10
%11 = load i32, i32* %8
%12 = load i32, i32* %10
%13 = add nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %23, label %15
15: ; preds = %5
%16 = load i8**, i8*** %9
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20, i32 3)
%22 = icmp ne i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %15, %5
%24 = load i32*, i32** %6
%25 = load i32, i32* %7
%26 = call i32 @init_pairing_random(i32* %24, i32 %25)
br label %61
27: ; preds = %15
%28 = load i8**, i8*** %9
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %32, i32 3)
%34 = icmp ne i32 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %27
%36 = load i32*, i32** %6
%37 = load i32, i32* %7
%38 = call i32 @init_pairing_natural(i32* %36, i32 %37)
br label %60
39: ; preds = %27
%40 = load i8**, i8*** %9
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %44, i32 3)
%46 = icmp ne i32 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %39
%48 = load i32*, i32** %6
%49 = load i32, i32* %7
%50 = call i32 @init_pairing_inverse(i32* %48, i32 %49)
br label %59
51: ; preds = %39
%52 = load i8**, i8*** %9
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %47
br label %60
60: ; preds = %59, %35
br label %61
61: ; preds = %60, %23
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"rnd\00"
@.str.1 = [4 x i8] c"nat\00"
@.str.2 = [4 x i8] c"inv\00"
@.str.3 = [45 x i8] c"Pairing strategy \22%s\22 unknown!!! Exiting...\0A\00"
define void @select_pairing(i32* %0, i32 %1, i32 %2, i8** nocapture %3, i32 %4) {
%6 = icmp slt i32 %4, %2
br i1 %6, label %7, label %13
7: ; preds = %5
%8 = sext i32 %4 to i64
%9 = getelementptr inbounds i8*, i8** %3, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10, i32 3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7, %5
%14 = tail call i32 @init_pairing_random(i32* %0, i32 %1)
br label %28
15: ; preds = %7
%16 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 3)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @init_pairing_natural(i32* %0, i32 %1)
br label %28
20: ; preds = %15
%21 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %10, i32 3)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @init_pairing_inverse(i32* %0, i32 %1)
br label %28
25: ; preds = %20
%26 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %18, %23, %13
ret void
}