#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 */
struct option {
  char *member_0;
  int member_1;
  char member_3;
  int /*<<< orphan*/ *member_2;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int getopt_long(int, char **, char *, struct option const *,
                int /*<<< orphan*/ *);
char *optarg;
int optind;
int /*<<< orphan*/ simxer_write_mixer(char *, int);
int /*<<< orphan*/ smixer_read_mixer(int);
int /*<<< orphan*/ smixer_remove_spaces_and_caps();
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int do_p = 0;
  int do_s = 0;
  int do_a = 0;
  int ok = 1;
  char *filename = NULL;
  int retval;
  const struct option longopts[] = {{"print", 0, NULL, 'p'},
                                    {"all", 0, NULL, 'a'},
                                    {"set", 2, NULL, 's'},
                                    {0}};
  while (1) {
    retval = getopt_long(argc, argv, "pas::", longopts, NULL);
    if (retval < 0) {
      break;
    }
    switch (retval) {
    case 'p':
      do_p = 1;
      break;
    case 'a':
      do_a = 1;
      break;
    case 's':
      do_s = 1;
      filename = optarg;
      break;
    default:
      ok = 0;
      break;
    }
  }
  if (optind < argc) {
    ok = 0;
  }
  smixer_remove_spaces_and_caps();
  if (ok && do_p && !do_s) {
    smixer_read_mixer(do_a);
  } else if (ok && do_s && !do_p) {
    simxer_write_mixer(filename, do_a);
  } else {
    fprintf(stderr,
            "smixer "
            "v1.0.3"
            " ("
            "2003-06-09"
            ") Copyright (C) 2000-2003 David Johnson\n"
            "  http://centerclick.org/programs/smixer/\n"
            "  smixer@centerclick.org\n"
            "usage: %s [-a] -p           (print settings)\n"
            "usage: %s [-a] --set [file] (set settings from file or stdin)\n",
            argv[0], argv[0]);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x90(%rbp),%rdi
lea    0x2bf5(%rip),%rsi
mov    $0x60,%edx
call   1060 <memcpy@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x90(%rbp),%rcx
lea    0xe44(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <getopt_long@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    11e6 <main+0x86>
jmp    1263 <main+0x103>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x94(%rbp)
sub    $0x61,%eax
je     1231 <main+0xd1>
jmp    11fd <main+0x9d>
mov    -0x94(%rbp),%eax
sub    $0x70,%eax
je     1225 <main+0xc5>
jmp    1211 <main+0xb1>
mov    -0x94(%rbp),%eax
sub    $0x73,%eax
je     123d <main+0xdd>
jmp    1257 <main+0xf7>
movl   $0x1,-0x14(%rbp)
jmp    125e <main+0xfe>
movl   $0x1,-0x1c(%rbp)
jmp    125e <main+0xfe>
movl   $0x1,-0x18(%rbp)
mov    0x2da5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    125e <main+0xfe>
movl   $0x0,-0x20(%rbp)
jmp    11b5 <main+0x55>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    127c <main+0x11c>
movl   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <smixer_remove_spaces_and_caps@plt>
cmpl   $0x0,-0x20(%rbp)
je     12ae <main+0x14e>
cmpl   $0x0,-0x14(%rbp)
je     12ae <main+0x14e>
cmpl   $0x0,-0x18(%rbp)
jne    12ae <main+0x14e>
mov    -0x1c(%rbp),%edi
call   1080 <smixer_read_mixer@plt>
jmp    1311 <main+0x1b1>
cmpl   $0x0,-0x20(%rbp)
je     12dd <main+0x17d>
cmpl   $0x0,-0x18(%rbp)
je     12dd <main+0x17d>
cmpl   $0x0,-0x14(%rbp)
jne    12dd <main+0x17d>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1070 <simxer_write_mixer@plt>
jmp    130c <main+0x1ac>
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd19(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1318 <main+0x1b8>
jmp    1311 <main+0x1b1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movaps 0x2c86(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2c6a(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2c4e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c32(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2c16(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2bfa(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xe5c(%rip),%rdx
lea    0x10(%rsp),%rcx
xor    %r8d,%r8d
call   1030 <getopt_long@plt>
test   %eax,%eax
js     126a <main+0x11a>
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
movl   $0x1,0x4(%rsp)
lea    0xe31(%rip),%r12
lea    0x10(%rsp),%r13
movl   $0x0,(%rsp)
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    122c <main+0xdc>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2de9(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
mov    $0x1,%r15d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %r8d,%r8d
call   1030 <getopt_long@plt>
test   %eax,%eax
js     1286 <main+0x136>
cmp    $0x73,%eax
je     1200 <main+0xb0>
cmp    $0x70,%eax
je     1250 <main+0x100>
cmp    $0x61,%eax
jne    1260 <main+0x110>
movl   $0x1,(%rsp)
jmp    1215 <main+0xc5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%r14d
jmp    1215 <main+0xc5>
nopl   0x0(%rax,%rax,1)
movl   $0x0,0x4(%rsp)
jmp    1215 <main+0xc5>
xor    %r14d,%r14d
movl   $0x1,0x4(%rsp)
xor    %r15d,%r15d
movl   $0x0,(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x2d4b(%rip),%rax
cmp    %ebp,(%rax)
setge  %bpl
xor    %eax,%eax
call   1040 <smixer_remove_spaces_and_caps@plt>
cmpl   $0x0,0x4(%rsp)
setne  %al
and    %bpl,%al
cmp    $0x1,%al
jne    12bf <main+0x16f>
test   %r14d,%r14d
je     12bf <main+0x16f>
test   %r15d,%r15d
jne    12bf <main+0x16f>
mov    (%rsp),%edi
call   1070 <smixer_read_mixer@plt>
xor    %eax,%eax
jmp    1301 <main+0x1b1>
test   %r15d,%r15d
setne  %cl
and    %cl,%al
cmp    $0x1,%al
jne    12e1 <main+0x191>
test   %r14d,%r14d
jne    12e1 <main+0x191>
mov    0x8(%rsp),%rdi
mov    (%rsp),%esi
call   1060 <simxer_write_mixer@plt>
xor    %eax,%eax
jmp    1301 <main+0x1b1>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rcx
lea    0xd20(%rip),%rsi
mov    %rcx,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i32, i8, i32* }
@.str = [6 x i8] c"print\00"
@.str.1 = [4 x i8] c"all\00"
@.str.2 = [4 x i8] c"set\00"
@__const.main.longopts = [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 112 to i32*) }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 97 to i32*) }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i32 2, i8 0, i32* inttoptr (i64 115 to i32*) }, %struct.option zeroinitializer]
@.str.3 = [6 x i8] c"pas::\00"
@optarg = global i8* null
@optind = global i32 0
@stderr = global i32 0
@.str.4 = [240 x i8] c"smixer v1.0.3 (2003-06-09) Copyright (C) 2000-2003 David Johnson\0A http://centerclick.org/programs/smixer/\0A smixer@centerclick.org\0Ausage: %s [-a] -p (print settings)\0Ausage: %s [-a] --set [file] (set settings from file or stdin)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca [4 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 1, i32* %9
store i8* null, i8** %10
%13 = bitcast [4 x %struct.option]* %12 to i8*
br label %14
14: ; preds = %2, %29
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %12, i64 0, i64 0
%18 = call i32 @getopt_long(i32 %15, i8** %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %struct.option* %17, i32* null)
store i32 %18, i32* %11
%19 = load i32, i32* %11
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %14
br label %30
22: ; preds = %14
%23 = load i32, i32* %11
switch i32 %23, label %28 [
i32 112, label %24
i32 97, label %25
i32 115, label %26
]
24: ; preds = %22
store i32 1, i32* %6
br label %29
25: ; preds = %22
store i32 1, i32* %8
br label %29
26: ; preds = %22
store i32 1, i32* %7
%27 = load i8*, i8** @optarg
store i8* %27, i8** %10
br label %29
28: ; preds = %22
store i32 0, i32* %9
br label %29
29: ; preds = %28, %26, %25, %24
br label %14
30: ; preds = %21
%31 = load i32, i32* @optind
%32 = load i32, i32* %4
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 0, i32* %9
br label %35
35: ; preds = %34, %30
%36 = call i32 (...) @smixer_remove_spaces_and_caps()
%37 = load i32, i32* %9
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* %6
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load i32, i32* %7
%44 = icmp ne i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* %8
%47 = call i32 @smixer_read_mixer(i32 %46)
br label %71
48: ; preds = %42, %39, %35
%49 = load i32, i32* %9
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %61
51: ; preds = %48
%52 = load i32, i32* %7
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = load i32, i32* %6
%56 = icmp ne i32 %55, 0
br i1 %56, label %61, label %57
57: ; preds = %54
%58 = load i8*, i8** %10
%59 = load i32, i32* %8
%60 = call i32 @simxer_write_mixer(i8* %58, i32 %59)
br label %70
61: ; preds = %54, %51, %48
%62 = load i32, i32* @stderr
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 0
%65 = load i8*, i8** %64
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 0
%68 = load i8*, i8** %67
%69 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str.4, i64 0, i64 0), i8* %65, i8* %68)
store i32 1, i32* %3
br label %72
70: ; preds = %57
br label %71
71: ; preds = %70, %45
store i32 0, i32* %3
br label %72
72: ; preds = %71, %61
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
%struct.option = type { i8*, i32, i8, i32* }
@.str = [6 x i8] c"print\00"
@.str.1 = [4 x i8] c"all\00"
@.str.2 = [4 x i8] c"set\00"
@__const.main.longopts = [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 112 to i32*) }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 97 to i32*) }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i32 2, i8 0, i32* inttoptr (i64 115 to i32*) }, %struct.option zeroinitializer]
@.str.3 = [6 x i8] c"pas::\00"
@optarg = global i8* null
@optind = global i32 0
@stderr = global i32 0
@.str.4 = [240 x i8] c"smixer v1.0.3 (2003-06-09) Copyright (C) 2000-2003 David Johnson\0A http://centerclick.org/programs/smixer/\0A smixer@centerclick.org\0Ausage: %s [-a] -p (print settings)\0Ausage: %s [-a] --set [file] (set settings from file or stdin)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4 x %struct.option]
%4 = bitcast [4 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %3, i64 0, i64 0
%6 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %struct.option* %5, i32* null)
%7 = icmp slt i32 %6, 0
br i1 %7, label %27, label %8
8: ; preds = %2, %19
%9 = phi i32 [ %25, %19 ], [ %6, %2 ]
%10 = phi i8* [ %24, %19 ], [ null, %2 ]
%11 = phi i32 [ %23, %19 ], [ 1, %2 ]
%12 = phi i32 [ %22, %19 ], [ 0, %2 ]
%13 = phi i32 [ %21, %19 ], [ 0, %2 ]
%14 = phi i32 [ %20, %19 ], [ 0, %2 ]
switch i32 %9, label %18 [
i32 112, label %19
i32 97, label %15
i32 115, label %16
]
15: ; preds = %8
br label %19
16: ; preds = %8
%17 = load i8*, i8** @optarg
br label %19
18: ; preds = %8
br label %19
19: ; preds = %8, %18, %16, %15
%20 = phi i32 [ %14, %18 ], [ %14, %16 ], [ %14, %15 ], [ 1, %8 ]
%21 = phi i32 [ %13, %18 ], [ 1, %16 ], [ %13, %15 ], [ %13, %8 ]
%22 = phi i32 [ %12, %18 ], [ %12, %16 ], [ 1, %15 ], [ %12, %8 ]
%23 = phi i32 [ 0, %18 ], [ %11, %16 ], [ %11, %15 ], [ %11, %8 ]
%24 = phi i8* [ %10, %18 ], [ %17, %16 ], [ %10, %15 ], [ %10, %8 ]
%25 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %struct.option* %5, i32* null)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %8
27: ; preds = %19, %2
%28 = phi i32 [ 0, %2 ], [ %20, %19 ]
%29 = phi i32 [ 0, %2 ], [ %21, %19 ]
%30 = phi i32 [ 0, %2 ], [ %22, %19 ]
%31 = phi i32 [ 1, %2 ], [ %23, %19 ]
%32 = phi i8* [ null, %2 ], [ %24, %19 ]
%33 = load i32, i32* @optind
%34 = icmp sge i32 %33, %0
%35 = call i32 (...) @smixer_remove_spaces_and_caps()
%36 = icmp ne i32 %31, 0
%37 = select i1 %34, i1 %36, i1 false
%38 = icmp ne i32 %28, 0
%39 = select i1 %37, i1 %38, i1 false
%40 = xor i1 %39, true
%41 = icmp ne i32 %29, 0
%42 = select i1 %40, i1 true, i1 %41
br i1 %42, label %45, label %43
43: ; preds = %27
%44 = call i32 @smixer_read_mixer(i32 %30)
br label %55
45: ; preds = %27
%46 = select i1 %37, i1 %41, i1 false
%47 = xor i1 %46, true
%48 = select i1 %47, i1 true, i1 %38
br i1 %48, label %51, label %49
49: ; preds = %45
%50 = call i32 @simxer_write_mixer(i8* %32, i32 %30)
br label %55
51: ; preds = %45
%52 = load i32, i32* @stderr
%53 = load i8*, i8** %1
%54 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str.4, i64 0, i64 0), i8* %53, i8* %53)
br label %55
55: ; preds = %43, %49, %51
%56 = phi i32 [ 1, %51 ], [ 0, %49 ], [ 0, %43 ]
ret i32 %56
}