#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 */
typedef int /*<<< orphan*/ argv;

/* Variables and functions */
int /*<<< orphan*/ gt_print(char *, char *);
int /*<<< orphan*/ memcpy(void *, char **, int);
scalar_t__ str_empty(char *);
int option_str(void *data, int argc, char **argv) {
  if (argc < 2 || str_empty(argv[1])) {
    gt_print("option `%s' need a string argument\n", argv[0]);
    return -1;
  }
  memcpy(data, &argv[1], sizeof(argv[1]));
  return 1;
}


x86 assembly (clang, -O0):
<option_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x2,-0x14(%rbp)
jl     1164 <option_str+0x34>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <str_empty@plt>
cmp    $0x0,%rax
je     1183 <option_str+0x53>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8e(%rip),%rdi
call   1050 <gt_print@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <option_str+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x8,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<option_str>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
cmp    $0x2,%esi
jl     114d <option_str+0x1d>
mov    %rdi,%r14
mov    0x8(%rbx),%rdi
call   1030 <str_empty@plt>
test   %rax,%rax
je     1163 <option_str+0x33>
mov    (%rbx),%rsi
lea    0xea9(%rip),%rdi
call   1050 <gt_print@plt>
mov    $0xffffffff,%eax
jmp    117c <option_str+0x4c>
add    $0x8,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"option `%s' need a string argument\0A\00"
define i32 @option_str(i8* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 2
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i8**, i8*** %7
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @str_empty(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %10, %3
%17 = load i8**, i8*** %7
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @gt_print(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 -1, i32* %4
br label %26
21: ; preds = %10
%22 = load i8*, i8** %5
%23 = load i8**, i8*** %7
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = call i32 @memcpy(i8* %22, i8** %24, i32 8)
store i32 1, i32* %4
br label %26
26: ; preds = %21, %16
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
@.str = [36 x i8] c"option `%s' need a string argument\0A\00"
define i32 @option_str(i8* %0, i32 %1, i8** %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @str_empty(i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5, %3
%11 = load i8*, i8** %2
%12 = tail call i32 @gt_print(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %5
%14 = tail call i32 @memcpy(i8* %0, i8** %6, i32 8)
br label %15
15: ; preds = %13, %10
%16 = phi i32 [ -1, %10 ], [ 1, %13 ]
ret i32 %16
}