#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*/ flag_to_view(int);
int is_stdout_filename(char *);
int parse_one_flag(char const **, char *);
int /*<<< orphan*/ view_save(int /*<<< orphan*/, char *, int, int, int);
void cmd_save(char *arg) {
  int to_stdout = is_stdout_filename(arg);
  int flag = 0, f, extended = 0;
  do {
    f = parse_one_flag((const char **)&arg, "eLlpq");
    if (f == 'e')
      extended = 1;
    else if (f)
      flag = f;
  } while (f > 0);
  if (flag == -1)
    return;
  view_save(flag_to_view(flag), arg, to_stdout, flag == 'L', extended);
}


x86 assembly (clang, -O0):
<cmd_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <is_stdout_filename@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <parse_one_flag@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x65,-0x14(%rbp)
jne    118f <cmd_save+0x4f>
movl   $0x1,-0x18(%rbp)
jmp    11a4 <cmd_save+0x64>
cmpl   $0x0,-0x14(%rbp)
je     119f <cmd_save+0x5f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a4 <cmd_save+0x64>
jmp    11a9 <cmd_save+0x69>
cmpl   $0x0,-0x14(%rbp)
jg     1166 <cmd_save+0x26>
cmpl   $0xffffffff,-0x10(%rbp)
jne    11c2 <cmd_save+0x82>
jmp    11e8 <cmd_save+0xa8>
mov    -0x10(%rbp),%edi
call   1060 <flag_to_view@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
cmpl   $0x4c,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x18(%rbp),%r8d
call   1030 <view_save@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_save>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
call   1040 <is_stdout_filename@plt>
mov    %eax,%r14d
xor    %r12d,%r12d
lea    0xe9d(%rip),%rbp
lea    0x8(%rsp),%rbx
xor    %r15d,%r15d
jmp    117a <cmd_save+0x3a>
nopl   (%rax)
mov    $0x1,%r15d
test   %eax,%eax
jle    1195 <cmd_save+0x55>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <parse_one_flag@plt>
cmp    $0x65,%eax
je     1170 <cmd_save+0x30>
test   %eax,%eax
je     1195 <cmd_save+0x55>
mov    %eax,%r12d
test   %eax,%eax
jg     117a <cmd_save+0x3a>
cmp    $0xffffffff,%r12d
je     11be <cmd_save+0x7e>
mov    %r12d,%edi
call   1060 <flag_to_view@plt>
mov    0x8(%rsp),%rsi
xor    %ecx,%ecx
cmp    $0x4c,%r12d
sete   %cl
mov    %eax,%edi
mov    %r14d,%edx
mov    %r15d,%r8d
call   1030 <view_save@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"eLlpq\00"
define void @cmd_save(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @is_stdout_filename(i8* %7)
store i32 %8, i32* %3
store i32 0, i32* %4
store i32 0, i32* %6
br label %9
9: ; preds = %21, %1
%10 = call i32 @parse_one_flag(i8** %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 101
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 1, i32* %6
br label %20
14: ; preds = %9
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = load i32, i32* %5
store i32 %18, i32* %4
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %13
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = icmp sgt i32 %22, 0
br i1 %23, label %9, label %24
24: ; preds = %21
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %28
27: ; preds = %24
br label %38
28: ; preds = %24
%29 = load i32, i32* %4
%30 = call i32 @flag_to_view(i32 %29)
%31 = load i8*, i8** %2
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 76
%35 = zext i1 %34 to i32
%36 = load i32, i32* %6
%37 = call i32 @view_save(i32 %30, i8* %31, i32 %32, i32 %35, i32 %36)
br label %38
38: ; preds = %28, %27
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"eLlpq\00"
define void @cmd_save(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = tail call i32 @is_stdout_filename(i8* %0)
br label %4
4: ; preds = %9, %1
%5 = phi i32 [ 0, %1 ], [ %10, %9 ]
%6 = phi i32 [ 0, %1 ], [ %11, %9 ]
%7 = call i32 @parse_one_flag(i8** %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %8 [
i32 101, label %9
i32 0, label %13
]
8: ; preds = %4
br label %9
9: ; preds = %4, %8
%10 = phi i32 [ %7, %8 ], [ %5, %4 ]
%11 = phi i32 [ %6, %8 ], [ 1, %4 ]
%12 = icmp sgt i32 %7, 0
br i1 %12, label %4, label %13
13: ; preds = %4, %9
%14 = phi i32 [ %11, %9 ], [ %6, %4 ]
%15 = phi i32 [ %10, %9 ], [ %5, %4 ]
%16 = icmp eq i32 %15, -1
br i1 %16, label %23, label %17
17: ; preds = %13
%18 = call i32 @flag_to_view(i32 %15)
%19 = load i8*, i8** %2
%20 = icmp eq i32 %15, 76
%21 = zext i1 %20 to i32
%22 = call i32 @view_save(i32 %18, i8* %19, i32 %3, i32 %21, i32 %14)
br label %23
23: ; preds = %13, %17
ret void
}