#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 EOF;
char *armdsp_init(int);
char *armdsp_run(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
int optind;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  int c;
  char *progname;
  char *err;
  while ((c = getopt(argc, argv, "")) != EOF) {
    switch (c) {
    default:
      usage();
    }
  }
  if (optind >= argc)
    usage();
  progname = argv[optind++];
  if (optind != argc)
    usage();
  if ((err = armdsp_init(1)) != NULL) {
    fprintf(stderr, "armdsp_init error: %s\n", err);
    exit(1);
  }
  if ((err = armdsp_run(progname)) != NULL) {
    fprintf(stderr, "armdsp_run error: %s\n", err);
    exit(1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea8(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%eax
je     11a7 <main+0x47>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    1176 <main+0x16>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     11c0 <main+0x60>
mov    $0x0,%al
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x2e15(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2e07(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     11ff <main+0x9f>
mov    $0x0,%al
call   1050 <usage@plt>
mov    $0x1,%edi
call   1070 <armdsp_init@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     123a <main+0xda>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xdd5(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1030 <armdsp_run@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1274 <main+0x114>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xdb2(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xeb8(%rip),%rdx
call   1060 <getopt@plt>
mov    0x2e68(%rip),%r12
cmp    (%r12),%eax
je     11aa <main+0x4a>
lea    0xe9f(%rip),%r15
nopl   (%rax)
xor    %eax,%eax
call   1050 <usage@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    (%r12),%eax
jne    1190 <main+0x30>
mov    0x2e2f(%rip),%r15
mov    (%r15),%eax
cmp    %ebx,%eax
jl     11c2 <main+0x62>
xor    %eax,%eax
call   1050 <usage@plt>
mov    (%r15),%eax
lea    0x1(%rax),%ecx
mov    %ecx,(%r15)
cltq
mov    (%r14,%rax,8),%r14
cmp    %ebx,%ecx
je     11d9 <main+0x79>
xor    %eax,%eax
call   1050 <usage@plt>
mov    $0x1,%edi
call   1070 <armdsp_init@plt>
test   %rax,%rax
jne    1203 <main+0xa3>
mov    %r14,%rdi
call   1030 <armdsp_run@plt>
test   %rax,%rax
jne    1215 <main+0xb5>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2dc6(%rip),%rcx
mov    (%rcx),%edi
lea    0xded(%rip),%rsi
jmp    1225 <main+0xc5>
mov    0x2db4(%rip),%rcx
mov    (%rcx),%edi
lea    0xdf2(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@EOF = global i32 0
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"armdsp_init error: %s\0A\00"
@.str.2 = [22 x i8] c"armdsp_run error: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = load i32, i32* %6
switch i32 %16, label %17 [
]
17: ; preds = %15
%18 = call i32 (...) @usage()
br label %19
19: ; preds = %17
br label %9
20: ; preds = %9
%21 = load i32, i32* @optind
%22 = load i32, i32* %4
%23 = icmp sge i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @usage()
br label %26
26: ; preds = %24, %20
%27 = load i8**, i8*** %5
%28 = load i32, i32* @optind
%29 = add nsw i32 %28, 1
store i32 %29, i32* @optind
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8*, i8** %27, i64 %30
%32 = load i8*, i8** %31
store i8* %32, i8** %7
%33 = load i32, i32* @optind
%34 = load i32, i32* %4
%35 = icmp ne i32 %33, %34
br i1 %35, label %36, label %38
36: ; preds = %26
%37 = call i32 (...) @usage()
br label %38
38: ; preds = %36, %26
%39 = call i8* @armdsp_init(i32 1)
store i8* %39, i8** %8
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %8
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %43)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %38
%47 = load i8*, i8** %7
%48 = call i8* @armdsp_run(i8* %47)
store i8* %48, i8** %8
%49 = icmp ne i8* %48, null
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %8
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %52)
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@EOF = global i32 0
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"armdsp_init error: %s\0A\00"
@.str.2 = [22 x i8] c"armdsp_run error: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2, %6
%7 = tail call i32 (...) @usage()
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = load i32, i32* @optind
%13 = icmp slt i32 %12, %0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = tail call i32 (...) @usage()
%16 = load i32, i32* @optind
br label %17
17: ; preds = %14, %11
%18 = phi i32 [ %16, %14 ], [ %12, %11 ]
%19 = add nsw i32 %18, 1
store i32 %19, i32* @optind
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = icmp eq i32 %19, %0
br i1 %23, label %26, label %24
24: ; preds = %17
%25 = tail call i32 (...) @usage()
br label %26
26: ; preds = %24, %17
%27 = tail call i8* @armdsp_init(i32 1)
%28 = icmp eq i8* %27, null
br i1 %28, label %33, label %29
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%32 = tail call i32 @exit(i32 1)
unreachable
33: ; preds = %26
%34 = tail call i8* @armdsp_run(i8* %22)
%35 = icmp eq i8* %34, null
br i1 %35, label %40, label %36
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = tail call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%39 = tail call i32 @exit(i32 1)
unreachable
40: ; preds = %33
ret i32 0
}