#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 Sfile_sep_make_argv(char *, char *, char *, int, int *, char ***, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int parse_line(char *progname, char *line, char *prefix, char *separators,
               int max_words, int *argc, char ***argv, int flag) {
  int ret, bsl_mode;
  char *to_parse;
  *argc = 0;
  *argv = NULL;
  to_parse = line;
  bsl_mode = (flag >> 1) & 15;
  if (prefix[0]) {
    if (strncmp(line, prefix, strlen(prefix)) == 0) {
      to_parse = line + strlen(prefix);
    } else {
      ret = 2;
      goto ex;
    }
  }
  ret = Sfile_sep_make_argv(progname, to_parse, separators, max_words, argc,
                            argv, (!(flag & 32)) | 4 | (bsl_mode << 5));
  if (ret < 0) {
    fprintf(stderr,
            "%s : Severe lack of resources during command line parsing\n",
            progname);
    goto ex;
  }
  if (ret == 0) {
    fprintf(stderr, "%s : Incomplete quotation in %s line: %s\n", progname,
            (flag & 32) ? "command" : "parsed", to_parse);
    goto ex;
  }
ex:;
  if (ret <= 0)
    Sfile_sep_make_argv("", "", "", 0, argc, argv, 2);
  return (ret);
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x18(%rbp),%eax
sar    $0x1,%eax
and    $0xf,%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1206 <parse_line+0xc6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f5 <parse_line+0xb5>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
jmp    1201 <parse_line+0xc1>
movl   $0x2,-0x34(%rbp)
jmp    12c1 <parse_line+0x181>
jmp    1206 <parse_line+0xc6>
mov    -0x8(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
or     $0x4,%eax
mov    -0x38(%rbp),%r10d
shl    $0x5,%r10d
or     %r10d,%eax
mov    %eax,(%rsp)
call   1050 <Sfile_sep_make_argv@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1273 <parse_line+0x133>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd99(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12c1 <parse_line+0x181>
cmpl   $0x0,-0x34(%rbp)
jne    12bc <parse_line+0x17c>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    0x18(%rbp),%esi
and    $0x20,%esi
lea    0xdd6(%rip),%rcx
lea    0xdc7(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
mov    -0x40(%rbp),%r8
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12c1 <parse_line+0x181>
jmp    12c1 <parse_line+0x181>
cmpl   $0x0,-0x34(%rbp)
jg     12ee <parse_line+0x1ae>
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9
lea    0xd60(%rip),%rdx
xor    %ecx,%ecx
mov    %rdx,%rdi
mov    %rdx,%rsi
movl   $0x2,(%rsp)
call   1050 <Sfile_sep_make_argv@plt>
mov    -0x34(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %rsi,%r13
mov    %rdi,%r14
mov    0x50(%rsp),%rax
movl   $0x0,(%r9)
movq   $0x0,(%rax)
cmpb   $0x0,(%rdx)
je     11b2 <parse_line+0x72>
mov    %rdx,%r15
mov    %rcx,0x10(%rsp)
mov    %r8d,%ebx
mov    %rdx,%rdi
call   1040 <strlen@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    $0x2,%ebp
test   %rax,%rax
jne    1263 <parse_line+0x123>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%r13
mov    %ebx,%r8d
mov    0x10(%rsp),%rcx
mov    0x58(%rsp),%eax
mov    %eax,%ebx
and    $0x20,%ebx
mov    %ebx,%edx
shr    $0x5,%edx
and    $0x1e,%eax
shl    $0x4,%eax
or     %edx,%eax
xor    $0x5,%eax
mov    %eax,(%rsp)
mov    %r14,%r15
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rcx,%rdx
mov    %r8d,%ecx
mov    %r12,%r8
mov    0x50(%rsp),%r14
mov    %r14,%r9
call   1050 <Sfile_sep_make_argv@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1228 <parse_line+0xe8>
jne    1263 <parse_line+0x123>
test   %ebx,%ebx
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rax
lea    0xe57(%rip),%rcx
cmove  %rax,%rcx
lea    0xe22(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%r8
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1242 <parse_line+0x102>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
lea    0xdc8(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
movl   $0x2,(%rsp)
lea    0xdea(%rip),%rdi
mov    %rdi,%rsi
mov    %rdi,%rdx
xor    %ecx,%ecx
mov    %r12,%r8
mov    %r14,%r9
call   1050 <Sfile_sep_make_argv@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"%s : Severe lack of resources during command line parsing\0A\00"
@.str.1 = [42 x i8] c"%s : Incomplete quotation in %s line: %s\0A\00"
@.str.2 = [8 x i8] c"command\00"
@.str.3 = [7 x i8] c"parsed\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @parse_line(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i32* %5, i8*** %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i8***
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
store i8* %0, i8** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32* %5, i32** %14
store i8*** %6, i8**** %15
store i32 %7, i32* %16
%20 = load i32*, i32** %14
store i32 0, i32* %20
%21 = load i8***, i8**** %15
store i8** null, i8*** %21
%22 = load i8*, i8** %10
store i8* %22, i8** %19
%23 = load i32, i32* %16
%24 = ashr i32 %23, 1
%25 = and i32 %24, 15
store i32 %25, i32* %18
%26 = load i8*, i8** %11
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %45
30: ; preds = %8
%31 = load i8*, i8** %10
%32 = load i8*, i8** %11
%33 = load i8*, i8** %11
%34 = call i32 @strlen(i8* %33)
%35 = call i64 @strncmp(i8* %31, i8* %32, i32 %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %30
%38 = load i8*, i8** %10
%39 = load i8*, i8** %11
%40 = call i32 @strlen(i8* %39)
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8* %42, i8** %19
br label %44
43: ; preds = %30
store i32 2, i32* %17
br label %82
44: ; preds = %37
br label %45
45: ; preds = %44, %8
%46 = load i8*, i8** %9
%47 = load i8*, i8** %19
%48 = load i8*, i8** %12
%49 = load i32, i32* %13
%50 = load i32*, i32** %14
%51 = load i8***, i8**** %15
%52 = load i32, i32* %16
%53 = and i32 %52, 32
%54 = icmp ne i32 %53, 0
%55 = xor i1 %54, true
%56 = zext i1 %55 to i32
%57 = or i32 %56, 4
%58 = load i32, i32* %18
%59 = shl i32 %58, 5
%60 = or i32 %57, %59
%61 = call i32 @Sfile_sep_make_argv(i8* %46, i8* %47, i8* %48, i32 %49, i32* %50, i8*** %51, i32 %60)
store i32 %61, i32* %17
%62 = load i32, i32* %17
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %45
%65 = load i32, i32* @stderr
%66 = load i8*, i8** %9
%67 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %66)
br label %82
68: ; preds = %45
%69 = load i32, i32* %17
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %81
71: ; preds = %68
%72 = load i32, i32* @stderr
%73 = load i8*, i8** %9
%74 = load i32, i32* %16
%75 = and i32 %74, 32
%76 = icmp ne i32 %75, 0
%77 = zext i1 %76 to i64
%78 = select i1 %76, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%79 = load i8*, i8** %19
%80 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %73, i8* %78, i8* %79)
br label %82
81: ; preds = %68
br label %82
82: ; preds = %81, %71, %64, %43
%83 = load i32, i32* %17
%84 = icmp sle i32 %83, 0
br i1 %84, label %85, label %89
85: ; preds = %82
%86 = load i32*, i32** %14
%87 = load i8***, i8**** %15
%88 = call i32 @Sfile_sep_make_argv(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i32 0, i32* %86, i8*** %87, i32 2)
br label %89
89: ; preds = %85, %82
%90 = load i32, i32* %17
ret i32 %90
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"%s : Severe lack of resources during command line parsing\0A\00"
@.str.1 = [42 x i8] c"%s : Incomplete quotation in %s line: %s\0A\00"
@.str.2 = [8 x i8] c"command\00"
@.str.3 = [7 x i8] c"parsed\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @parse_line(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i32* %5, i8*** %6, i32 %7) {
store i32 0, i32* %5
store i8** null, i8*** %6
%9 = load i8, i8* %2
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = tail call i32 @strlen(i8* %2)
%13 = tail call i64 @strncmp(i8* %1, i8* %2, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %41
15: ; preds = %11
%16 = tail call i32 @strlen(i8* %2)
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %1, i64 %17
br label %19
19: ; preds = %15, %8
%20 = phi i8* [ %18, %15 ], [ %1, %8 ]
%21 = and i32 %7, 32
%22 = icmp eq i32 %21, 0
%23 = lshr exact i32 %21, 5
%24 = shl i32 %7, 4
%25 = and i32 %24, 480
%26 = or i32 %23, %25
%27 = xor i32 %26, 5
%28 = tail call i32 @Sfile_sep_make_argv(i8* %0, i8* %20, i8* %3, i32 %4, i32* %5, i8*** %6, i32 %27)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %19
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %39
33: ; preds = %19
%34 = icmp eq i32 %28, 0
br i1 %34, label %35, label %41
35: ; preds = %33
%36 = load i32, i32* @stderr
%37 = select i1 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%38 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %37, i8* %20)
br label %39
39: ; preds = %30, %35
%40 = tail call i32 @Sfile_sep_make_argv(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i32 0, i32* %5, i8*** %6, i32 2)
br label %41
41: ; preds = %33, %11, %39
%42 = phi i32 [ %28, %39 ], [ %28, %33 ], [ 2, %11 ]
ret i32 %42
}