#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 cmd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettoken(char **, char *, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int /*<<< orphan*/ panic(char *);
struct cmd *parseline(char **, char *);
struct cmd *parseredirs(struct cmd *, char **, char *);
int /*<<< orphan*/ peek(char **, char *, char *);
struct cmd *parseblock(char **ps, char *es) {
  struct cmd *cmd;
  if (!peek(ps, es, "("))
    panic("parseblock");
  gettoken(ps, es, 0, 0);
  cmd = parseline(ps, es);
  if (!peek(ps, es, ")"))
    panic("syntax - missing )");
  gettoken(ps, es, 0, 0);
  cmd = parseredirs(cmd, ps, es);
  return cmd;
}


x86 assembly (clang, -O0):
<parseblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe91(%rip),%rdx
call   1030 <peek@plt>
cmp    $0x0,%eax
jne    1189 <parseblock+0x39>
lea    0xe7e(%rip),%rdi
call   1060 <panic@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <gettoken@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <parseline@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe64(%rip),%rdx
call   1030 <peek@plt>
cmp    $0x0,%eax
jne    11d4 <parseblock+0x84>
lea    0xe3e(%rip),%rdi
call   1060 <panic@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <gettoken@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1070 <parseredirs@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseblock>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9e(%rip),%rdx
call   1030 <peek@plt>
test   %eax,%eax
jne    1177 <parseblock+0x27>
lea    0xe90(%rip),%rdi
call   1060 <panic@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <gettoken@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <parseline@plt>
mov    %rax,%r15
lea    0xe83(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <peek@plt>
test   %eax,%eax
jne    11b6 <parseblock+0x66>
lea    0xe5c(%rip),%rdi
call   1060 <panic@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <gettoken@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <parseredirs@plt>

LLVM IR (-O0):
%struct.cmd = type { i32 }
@.str = [2 x i8] c"(\00"
@.str.1 = [11 x i8] c"parseblock\00"
@.str.2 = [2 x i8] c")\00"
@.str.3 = [19 x i8] c"syntax - missing )\00"
define %struct.cmd* @parseblock(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca %struct.cmd*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %4
%8 = call i32 @peek(i8** %6, i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @panic(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %4
%15 = call i32 @gettoken(i8** %13, i8* %14, i32 0, i32 0)
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %4
%18 = call %struct.cmd* @parseline(i8** %16, i8* %17)
store %struct.cmd* %18, %struct.cmd** %5
%19 = load i8**, i8*** %3
%20 = load i8*, i8** %4
%21 = call i32 @peek(i8** %19, i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %12
%24 = call i32 @panic(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %12
%26 = load i8**, i8*** %3
%27 = load i8*, i8** %4
%28 = call i32 @gettoken(i8** %26, i8* %27, i32 0, i32 0)
%29 = load %struct.cmd*, %struct.cmd** %5
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %4
%32 = call %struct.cmd* @parseredirs(%struct.cmd* %29, i8** %30, i8* %31)
store %struct.cmd* %32, %struct.cmd** %5
%33 = load %struct.cmd*, %struct.cmd** %5
ret %struct.cmd* %33
}

LLVM IR (-O2):
%struct.cmd = type { i32 }
@.str = [2 x i8] c"(\00"
@.str.1 = [11 x i8] c"parseblock\00"
@.str.2 = [2 x i8] c")\00"
@.str.3 = [19 x i8] c"syntax - missing )\00"
define %struct.cmd* @parseblock(i8** %0, i8* %1) {
%3 = tail call i32 @peek(i8** %0, i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @panic(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @gettoken(i8** %0, i8* %1, i32 0, i32 0)
%9 = tail call %struct.cmd* @parseline(i8** %0, i8* %1)
%10 = tail call i32 @peek(i8** %0, i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @panic(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
%15 = tail call i32 @gettoken(i8** %0, i8* %1, i32 0, i32 0)
%16 = tail call %struct.cmd* @parseredirs(%struct.cmd* %9, i8** %0, i8* %1)
ret %struct.cmd* %16
}