#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 parArgTypExists(int, char **, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int parGetString(int argc, char *argv[], char argType, char *value) {
  int a;
  a = parArgTypExists(argc, argv, argType);
  if (a == 0)
    return (0);
  if (a >= (argc - 1))
    return (0);
  if (strlen(argv[a + 1]) > 1024)
    return (0);
  strcpy(value, argv[a + 1]);
  return (1);
}


x86 assembly (clang, -O0):
<parGetString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1050 <parArgTypExists@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1171 <parGetString+0x41>
movl   $0x0,-0x4(%rbp)
jmp    11dc <parGetString+0xac>
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jl     118e <parGetString+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11dc <parGetString+0xac>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
cmp    $0x400,%eax
jle    11bb <parGetString+0x8b>
movl   $0x0,-0x4(%rbp)
jmp    11dc <parGetString+0xac>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parGetString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
call   1050 <parArgTypExists@plt>
xor    %r15d,%r15d
test   %eax,%eax
je     117c <parGetString+0x4c>
add    $0xffffffff,%ebp
cmp    %ebp,%eax
jge    117c <parGetString+0x4c>
movslq %eax,%rbp
mov    0x8(%rbx,%rbp,8),%rdi
call   1040 <strlen@plt>
cmp    $0x400,%eax
jg     117c <parGetString+0x4c>
add    $0x1,%rbp
mov    (%rbx,%rbp,8),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parGetString(i32 %0, i8** %1, i8 signext %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8 %2, i8* %8
store i8* %3, i8** %9
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8, i8* %8
%14 = call i32 @parArgTypExists(i32 %11, i8** %12, i8 signext %13)
store i32 %14, i32* %10
%15 = load i32, i32* %10
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %4
store i32 0, i32* %5
br label %43
18: ; preds = %4
%19 = load i32, i32* %10
%20 = load i32, i32* %6
%21 = sub nsw i32 %20, 1
%22 = icmp sge i32 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 0, i32* %5
br label %43
24: ; preds = %18
%25 = load i8**, i8*** %7
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %25, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @strlen(i8* %30)
%32 = icmp sgt i32 %31, 1024
br i1 %32, label %33, label %34
33: ; preds = %24
store i32 0, i32* %5
br label %43
34: ; preds = %24
%35 = load i8*, i8** %9
%36 = load i8**, i8*** %7
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %36, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @strcpy(i8* %35, i8* %41)
store i32 1, i32* %5
br label %43
43: ; preds = %34, %33, %23, %17
%44 = load i32, i32* %5
ret i32 %44
}

LLVM IR (-O2):
define i32 @parGetString(i32 %0, i8** %1, i8 signext %2, i8* %3) {
%5 = tail call i32 @parArgTypExists(i32 %0, i8** %1, i8 signext %2)
%6 = icmp ne i32 %5, 0
%7 = add nsw i32 %0, -1
%8 = icmp slt i32 %5, %7
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %20
10: ; preds = %4
%11 = add nsw i32 %5, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strlen(i8* %14)
%16 = icmp sgt i32 %15, 1024
br i1 %16, label %20, label %17
17: ; preds = %10
%18 = load i8*, i8** %13
%19 = tail call i32 @strcpy(i8* %3, i8* %18)
br label %20
20: ; preds = %10, %4, %17
%21 = phi i32 [ 1, %17 ], [ 0, %4 ], [ 0, %10 ]
ret i32 %21
}