#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*/ echo_test_setup(int, char **, char const *);
int /*<<< orphan*/ printf(char *);
int test_validation(int, char **, char const *);
bool test_opt_w_missing_arg(const char *optstring) {
  int argc = 2;
  char *argv[] = {"test", "-a"};
  printf("Testing with 1 opt that takes an optarg, which is missing!\n");
  echo_test_setup(argc, argv, optstring);
  return test_validation(argc, argv, optstring);
}


x86 assembly (clang, -O0):
<test_opt_w_missing_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    0x2cc6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <echo_test_setup@plt>
mov    -0xc(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1050 <test_validation@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_opt_w_missing_arg>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movaps 0x2ccf(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r14
mov    $0x2,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <echo_test_setup@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <test_validation@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
@.str.1 = [3 x i8] c"-a\00"
@__const.test_opt_w_missing_arg.argv = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [60 x i8] c"Testing with 1 opt that takes an optarg, which is missing!\0A\00"
define i32 @test_opt_w_missing_arg(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [2 x i8*]
store i8* %0, i8** %2
store i32 2, i32* %3
%5 = bitcast [2 x i8*]* %4 to i8*
%6 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* %3
%8 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%9 = load i8*, i8** %2
%10 = call i32 @echo_test_setup(i32 %7, i8** %8, i8* %9)
%11 = load i32, i32* %3
%12 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%13 = load i8*, i8** %2
%14 = call i32 @test_validation(i32 %11, i8** %12, i8* %13)
ret i32 %14
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
@.str.1 = [3 x i8] c"-a\00"
@__const.test_opt_w_missing_arg.argv = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0)]
@str = [59 x i8] c"Testing with 1 opt that takes an optarg, which is missing!\00"
define i32 @test_opt_w_missing_arg(i8* %0) {
%2 = alloca [2 x i8*]
%3 = bitcast [2 x i8*]* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%5 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%6 = call i32 @echo_test_setup(i32 2, i8** %5, i8* %0)
%7 = call i32 @test_validation(i32 2, i8** %5, i8* %0)
ret i32 %7
}