#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int testExpr(int, char **);
int main(int argc, char *argv[]) {
  if (strcmp(argv[0], "[") == 0) {
    if (strcmp(argv[argc - 1], "]") != 0) {
      fprintf(stderr, "%s: syntax error\n", argv[0]);
      return 1;
    };
    argc--;
  };
  int status = testExpr(argc - 1, &argv[1]);
  if (status == -1) {
    fprintf(stderr, "%s: syntax error\n", argv[0]);
    return 1;
  };
  return status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11bb <main+0x8b>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11b2 <main+0x82>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe63(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1209 <main+0xd9>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <testExpr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1203 <main+0xd3>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe12(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1209 <main+0xd9>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
lea    0xebe(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1161 <main+0x31>
add    $0xffffffff,%ebp
lea    0x8(%rbx),%rsi
mov    %ebp,%edi
call   1050 <testExpr@plt>
cmp    $0xffffffff,%eax
jne    1197 <main+0x67>
jmp    117a <main+0x4a>
movslq %ebp,%rax
mov    -0x8(%rbx,%rax,8),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     119e <main+0x6e>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
add    $0xffffffff,%ebp
jmp    114c <main+0x1c>

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

LLVM IR (-O2):
@.str = [2 x i8] c"[\00"
@.str.1 = [2 x i8] c"]\00"
@stderr = global i32 0
@.str.2 = [18 x i8] c"%s: syntax error\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = add nsw i32 %0, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %6, %2
%14 = phi i32 [ %0, %2 ], [ %7, %6 ]
%15 = add nsw i32 %14, -1
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = tail call i32 @testExpr(i32 %15, i8** %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %23
19: ; preds = %13, %6
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %1
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19, %13
%24 = phi i32 [ %17, %13 ], [ 1, %19 ]
ret i32 %24
}