#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 */
typedef union node {
  int dummy;
} node;
struct parser {
  int dummy;
};

/* Variables and functions */
union node *parse_arith_assign(struct parser *, union node *);
union node *parse_arith_unary(struct parser *);
union node *parse_arith_value(struct parser *);
int /*<<< orphan*/ parse_skipspace(struct parser *);
scalar_t__ source_peek(char *);
union node *parse_arith_expr(struct parser *p) {
  union node *node = 0;
  char c[2];
  parse_skipspace(p);
  if (source_peek(&c[0]) <= 0)
    return 0;
  if (!node)
    node = parse_arith_assign(p, node);
  if (!node)
    node = parse_arith_unary(p);
  if (!node)
    node = parse_arith_value(p);
  return node;
}


x86 assembly (clang, -O0):
<parse_arith_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <parse_skipspace@plt>
lea    -0x1a(%rbp),%rdi
call   1060 <source_peek@plt>
cmp    $0x0,%rax
jg     118d <parse_arith_expr+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    11e1 <parse_arith_expr+0x91>
cmpq   $0x0,-0x18(%rbp)
jne    11a9 <parse_arith_expr+0x59>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <parse_arith_assign@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c1 <parse_arith_expr+0x71>
mov    -0x10(%rbp),%rdi
call   1030 <parse_arith_unary@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11d9 <parse_arith_expr+0x89>
mov    -0x10(%rbp),%rdi
call   1070 <parse_arith_value@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_arith_expr>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1050 <parse_skipspace@plt>
lea    0xe(%rsp),%rdi
call   1060 <source_peek@plt>
test   %rax,%rax
jle    1192 <parse_arith_expr+0x42>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <parse_arith_assign@plt>
test   %rax,%rax
jne    1194 <parse_arith_expr+0x44>
mov    %rbx,%rdi
call   1030 <parse_arith_unary@plt>
test   %rax,%rax
jne    1194 <parse_arith_expr+0x44>
mov    %rbx,%rdi
call   1070 <parse_arith_value@plt>
jmp    1194 <parse_arith_expr+0x44>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%union.node = type { i32 }
%struct.parser = type { i32 }
define %union.node* @parse_arith_expr(%struct.parser* %0) {
%2 = alloca %union.node*
%3 = alloca %struct.parser*
%4 = alloca %union.node*
%5 = alloca [2 x i8]
store %struct.parser* %0, %struct.parser** %3
store %union.node* null, %union.node** %4
%6 = load %struct.parser*, %struct.parser** %3
%7 = call i32 @parse_skipspace(%struct.parser* %6)
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%9 = call i64 @source_peek(i8* %8)
%10 = icmp sle i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store %union.node* null, %union.node** %2
br label %33
12: ; preds = %1
%13 = load %union.node*, %union.node** %4
%14 = icmp ne %union.node* %13, null
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = load %struct.parser*, %struct.parser** %3
%17 = load %union.node*, %union.node** %4
%18 = call %union.node* @parse_arith_assign(%struct.parser* %16, %union.node* %17)
store %union.node* %18, %union.node** %4
br label %19
19: ; preds = %15, %12
%20 = load %union.node*, %union.node** %4
%21 = icmp ne %union.node* %20, null
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load %struct.parser*, %struct.parser** %3
%24 = call %union.node* @parse_arith_unary(%struct.parser* %23)
store %union.node* %24, %union.node** %4
br label %25
25: ; preds = %22, %19
%26 = load %union.node*, %union.node** %4
%27 = icmp ne %union.node* %26, null
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load %struct.parser*, %struct.parser** %3
%30 = call %union.node* @parse_arith_value(%struct.parser* %29)
store %union.node* %30, %union.node** %4
br label %31
31: ; preds = %28, %25
%32 = load %union.node*, %union.node** %4
store %union.node* %32, %union.node** %2
br label %33
33: ; preds = %31, %11
%34 = load %union.node*, %union.node** %2
ret %union.node* %34
}

LLVM IR (-O2):
%union.node = type { i32 }
%struct.parser = type { i32 }
define %union.node* @parse_arith_expr(%struct.parser* %0) {
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @parse_skipspace(%struct.parser* %0)
%5 = call i64 @source_peek(i8* %3)
%6 = icmp slt i64 %5, 1
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = call %union.node* @parse_arith_assign(%struct.parser* %0, %union.node* null)
%9 = icmp eq %union.node* %8, null
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = call %union.node* @parse_arith_unary(%struct.parser* %0)
%12 = icmp eq %union.node* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call %union.node* @parse_arith_value(%struct.parser* %0)
br label %15
15: ; preds = %7, %10, %13, %1
%16 = phi %union.node* [ null, %1 ], [ %11, %10 ], [ %14, %13 ], [ %8, %7 ]
ret %union.node* %16
}