#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 */
struct opt_config {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ opt_config_print_usage(struct opt_config *);
int /*<<< orphan*/ stderr;
void expect_next_arg(struct opt_config *conf, int argc, char **argv, int cur,
                     char *flag_name, char *msg) {
  if (argc == cur + 1 || (argv[cur + 1][0] == '-' && argv[cur + 1][0] == '-')) {
    fprintf(stderr, msg, flag_name);
    opt_config_print_usage(conf);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<expect_next_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     1199 <expect_next_arg+0x69>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11c2 <expect_next_arg+0x92>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11c2 <expect_next_arg+0x92>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <opt_config_print_usage@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_next_arg>:
push   %rbx
mov    %rdi,%rbx
add    $0x1,%ecx
cmp    %esi,%ecx
je     1149 <expect_next_arg+0x19>
movslq %ecx,%rax
mov    (%rdx,%rax,8),%rax
cmpb   $0x2d,(%rax)
je     1149 <expect_next_arg+0x19>
pop    %rbx
ret
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    %r9,%rsi
mov    %r8,%rdx
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <opt_config_print_usage@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.opt_config = type { i32 }
@stderr = global i32 0
define void @expect_next_arg(%struct.opt_config* %0, i32 %1, i8** %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca %struct.opt_config*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
store %struct.opt_config* %0, %struct.opt_config** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i32, i32* %8
%14 = load i32, i32* %10
%15 = add nsw i32 %14, 1
%16 = icmp eq i32 %13, %15
br i1 %16, label %39, label %17
17: ; preds = %6
%18 = load i8**, i8*** %9
%19 = load i32, i32* %10
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 45
br i1 %27, label %28, label %47
28: ; preds = %17
%29 = load i8**, i8*** %9
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = load i8*, i8** %33
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 45
br i1 %38, label %39, label %47
39: ; preds = %28, %6
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %12
%42 = load i8*, i8** %11
%43 = call i32 @fprintf(i32 %40, i8* %41, i8* %42)
%44 = load %struct.opt_config*, %struct.opt_config** %7
%45 = call i32 @opt_config_print_usage(%struct.opt_config* %44)
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %28, %17
ret void
}

LLVM IR (-O2):
%struct.opt_config = type { i32 }
@stderr = global i32 0
define void @expect_next_arg(%struct.opt_config* %0, i32 %1, i8** nocapture %2, i32 %3, i8* %4, i8* %5) {
%7 = add nsw i32 %3, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = sext i32 %7 to i64
%11 = getelementptr inbounds i8*, i8** %2, i64 %10
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 45
br i1 %14, label %15, label %20
15: ; preds = %9, %6
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* %5, i8* %4)
%18 = tail call i32 @opt_config_print_usage(%struct.opt_config* %0)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %9
ret void
}