#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*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void hcplates_advance_argument(int *i, int argc, char **argv) {
  if (argc <= *i + 1) {
    fprintf(stderr,
            "%s: input parameters: error: option \"%s\" needs a value\n",
            argv[0], argv[*i]);
    exit(-1);
  }
  *i += 1;
}


x86 assembly (clang, -O0):
<hcplates_advance_argument>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     117c <hcplates_advance_argument+0x5c>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe93(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hcplates_advance_argument>:
push   %rax
movslq (%rdi),%rcx
lea    0x1(%rcx),%eax
cmp    %esi,%eax
jge    112f <hcplates_advance_argument+0xf>
mov    %eax,(%rdi)
pop    %rax
ret
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    (%rdx),%rax
mov    (%rdx,%rcx,8),%rcx
lea    0xeba(%rip),%rsi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"%s: input parameters: error: option \22%s\22 needs a value\0A\00"
define void @hcplates_advance_argument(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8**
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
%11 = icmp sle i32 %7, %10
br i1 %11, label %12, label %25
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %6
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %6
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %17, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %22)
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %3
%26 = load i32*, i32** %4
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"%s: input parameters: error: option \22%s\22 needs a value\0A\00"
define void @hcplates_advance_argument(i32* nocapture %0, i32 %1, i8** nocapture %2) {
%4 = load i32, i32* %0
%5 = add nsw i32 %4, 1
%6 = icmp slt i32 %5, %1
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %2
%10 = sext i32 %4 to i64
%11 = getelementptr inbounds i8*, i8** %2, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %12)
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %3
store i32 %5, i32* %0
ret void
}