#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 const *);
int optind;
int /*<<< orphan*/ show_usage();
int /*<<< orphan*/ split_key_value(char *, char **, char **);
int /*<<< orphan*/ stderr;
bool arg_get_type_and_name(const char *cmd, int argc, char **argv,
                           const char **type_ret, const char **name_ret) {
  if (optind >= argc) {
    fprintf(stderr, "susetest config %s: missing type=name argument\n", cmd);
    show_usage();
    return false;
  }
  if (!split_key_value(argv[optind++], (char **)type_ret, (char **)name_ret)) {
    fprintf(stderr, "susetest config %s: bad argument, should be type=name\n",
            cmd);
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<arg_get_type_and_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jl     1189 <arg_get_type_and_name+0x59>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <show_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ed <arg_get_type_and_name+0xbd>
mov    -0x20(%rbp),%rax
mov    0x2e54(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2e46(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <split_key_value@plt>
cmp    $0x0,%eax
jne    11e6 <arg_get_type_and_name+0xb6>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe5b(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ed <arg_get_type_and_name+0xbd>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_get_type_and_name>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eab(%rip),%rax
movslq (%rax),%rdi
cmp    %esi,%edi
jge    117d <arg_get_type_and_name+0x4d>
lea    0x1(%rdi),%esi
mov    %esi,(%rax)
mov    (%rdx,%rdi,8),%rdi
mov    %rcx,%rsi
mov    %r8,%rdx
call   1030 <split_key_value@plt>
mov    $0x1,%ebp
test   %eax,%eax
jne    119e <arg_get_type_and_name+0x6e>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
xor    %ebp,%ebp
jmp    119e <arg_get_type_and_name+0x6e>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <show_usage@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@optind = global i32 0
@stderr = global i32 0
@.str = [48 x i8] c"susetest config %s: missing type=name argument\0A\00"
@.str.1 = [55 x i8] c"susetest config %s: bad argument, should be type=name\0A\00"
define i32 @arg_get_type_and_name(i8* %0, i32 %1, i8** %2, i8** %3, i8** %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8**
%11 = alloca i8**
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i8** %3, i8*** %10
store i8** %4, i8*** %11
%12 = load i32, i32* @optind
%13 = load i32, i32* %8
%14 = icmp sge i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %5
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %7
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 (...) @show_usage()
store i32 0, i32* %6
br label %36
20: ; preds = %5
%21 = load i8**, i8*** %9
%22 = load i32, i32* @optind
%23 = add nsw i32 %22, 1
store i32 %23, i32* @optind
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds i8*, i8** %21, i64 %24
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %10
%28 = load i8**, i8*** %11
%29 = call i32 @split_key_value(i8* %26, i8** %27, i8** %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %20
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %7
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %33)
store i32 0, i32* %6
br label %36
35: ; preds = %20
store i32 1, i32* %6
br label %36
36: ; preds = %35, %31, %15
%37 = load i32, i32* %6
ret i32 %37
}

LLVM IR (-O2):
@optind = global i32 0
@stderr = global i32 0
@.str = [48 x i8] c"susetest config %s: missing type=name argument\0A\00"
@.str.1 = [55 x i8] c"susetest config %s: bad argument, should be type=name\0A\00"
define i32 @arg_get_type_and_name(i8* %0, i32 %1, i8** nocapture %2, i8** %3, i8** %4) {
%6 = load i32, i32* @optind
%7 = icmp slt i32 %6, %1
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0)
%11 = tail call i32 (...) @show_usage()
br label %22
12: ; preds = %5
%13 = add nsw i32 %6, 1
store i32 %13, i32* @optind
%14 = sext i32 %6 to i64
%15 = getelementptr inbounds i8*, i8** %2, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 @split_key_value(i8* %16, i8** %3, i8** %4)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %22
22: ; preds = %12, %19, %8
%23 = phi i32 [ 0, %8 ], [ 0, %19 ], [ 1, %12 ]
ret i32 %23
}