#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 */
struct cmd *commandcmd(struct cmd *, struct cmd *);
int /*<<< orphan*/ gettoken(char **, char *, int /*<<< orphan*/,
                            int /*<<< orphan*/);
struct cmd *parsepipe(char **, char *);
scalar_t__ peek(char **, char *, char *);
struct cmd *parsecomd(char **ps, char *es) {
  struct cmd *cmd;
  cmd = parsepipe(ps, es);
  if (peek(ps, es, ";")) {
    gettoken(ps, es, 0, 0);
    cmd = commandcmd(cmd, parsecomd(ps, es));
  }
  return cmd;
}


x86 assembly (clang, -O0):
<parsecomd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <parsepipe@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe80(%rip),%rdx
call   1030 <peek@plt>
cmp    $0x0,%rax
je     11c5 <parsecomd+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <gettoken@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <parsecomd@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rsi
call   1070 <commandcmd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parsecomd>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%rbx
call   1060 <parsepipe@plt>
mov    %rax,%r14
lea    0xe96(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <peek@plt>
test   %rax,%rax
je     11a4 <parsecomd+0x54>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <gettoken@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <parsecomd@plt>
mov    %r14,%rdi
mov    %rax,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <commandcmd@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.cmd = type { i32 }
@.str = [2 x i8] c";\00"
define %struct.cmd* @parsecomd(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 %struct.cmd* @parsepipe(i8** %6, i8* %7)
store %struct.cmd* %8, %struct.cmd** %5
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %4
%11 = call i64 @peek(i8** %9, i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %4
%16 = call i32 @gettoken(i8** %14, i8* %15, i32 0, i32 0)
%17 = load %struct.cmd*, %struct.cmd** %5
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %4
%20 = call %struct.cmd* @parsecomd(i8** %18, i8* %19)
%21 = call %struct.cmd* @commandcmd(%struct.cmd* %17, %struct.cmd* %20)
store %struct.cmd* %21, %struct.cmd** %5
br label %22
22: ; preds = %13, %2
%23 = load %struct.cmd*, %struct.cmd** %5
ret %struct.cmd* %23
}

LLVM IR (-O2):
%struct.cmd = type { i32 }
@.str = [2 x i8] c";\00"
define %struct.cmd* @parsecomd(i8** %0, i8* %1) {
%3 = tail call %struct.cmd* @parsepipe(i8** %0, i8* %1)
%4 = tail call i64 @peek(i8** %0, i8* %1, 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 %8
6: ; preds = %2, %8
%7 = phi %struct.cmd* [ %11, %8 ], [ %3, %2 ]
ret %struct.cmd* %7
8: ; preds = %2
%9 = tail call i32 @gettoken(i8** %0, i8* %1, i32 0, i32 0)
%10 = tail call %struct.cmd* @parsecomd(i8** %0, i8* %1)
%11 = tail call %struct.cmd* @commandcmd(%struct.cmd* %3, %struct.cmd* %10)
br label %6
}