#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *getparameter(int *ip, int argc, char **argv) {
  int i;
  (*ip)++;
  i = (*ip);
  if (i >= argc) {
    fprintf(stderr, "Invalid use of %s option\n", argv[i - 1]);
    return NULL;
  }
  return argv[i];
}


x86 assembly (clang, -O0):
<getparameter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1176 <getparameter+0x66>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1186 <getparameter+0x76>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getparameter>:
push   %rax
movslq (%rdi),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%rdi)
cmp    %esi,%ecx
jge    1124 <getparameter+0x14>
mov    0x8(%rdx,%rax,8),%rax
pop    %rcx
ret
mov    0x2eb5(%rip),%rcx
mov    (%rcx),%edi
mov    (%rdx,%rax,8),%rdx
lea    0xec8(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid use of %s option\0A\00"
define i8* @getparameter(i32* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = load i32, i32* %6
%16 = icmp sge i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %7
%20 = load i32, i32* %8
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %19, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %24)
store i8* null, i8** %4
br label %32
26: ; preds = %3
%27 = load i8**, i8*** %7
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
store i8* %31, i8** %4
br label %32
32: ; preds = %26, %17
%33 = load i8*, i8** %4
ret i8* %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid use of %s option\0A\00"
define i8* @getparameter(i32* nocapture %0, i32 %1, i8** nocapture %2) {
%4 = load i32, i32* %0
%5 = add nsw i32 %4, 1
store i32 %5, i32* %0
%6 = icmp slt i32 %5, %1
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8*, i8** %2, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %17
13: ; preds = %3
%14 = sext i32 %5 to i64
%15 = getelementptr inbounds i8*, i8** %2, i64 %14
%16 = load i8*, i8** %15
br label %17
17: ; preds = %13, %7
%18 = phi i8* [ null, %7 ], [ %16, %13 ]
ret i8* %18
}