#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 int /*<<< orphan*/ ssize_t;

/* Variables and functions */
scalar_t__ accept(char const **, char);
char *parse_factor(char const *, int /*<<< orphan*/ *);
const char *parse_unary(const char *p, ssize_t *value) {
  if (accept(&p, '+')) {
    p = parse_unary(p, value);
  } else if (accept(&p, '-')) {
    if ((p = parse_unary(p, value)))
      *value = -(*value);
  } else {
    p = parse_factor(p, value);
  }
  return p;
}


x86 assembly (clang, -O0):
<parse_unary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x2b,%esi
call   1050 <accept@plt>
cmp    $0x0,%rax
je     116e <parse_unary+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <parse_unary@plt>
mov    %rax,-0x8(%rbp)
jmp    11ca <parse_unary+0x9a>
lea    -0x8(%rbp),%rdi
mov    $0x2d,%esi
call   1050 <accept@plt>
cmp    $0x0,%rax
je     11b4 <parse_unary+0x84>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <parse_unary@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     11af <parse_unary+0x7f>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11c5 <parse_unary+0x95>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <parse_factor@plt>
mov    %rax,-0x8(%rbp)
jmp    11ca <parse_unary+0x9a>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_unary>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x2b,%esi
call   1050 <accept@plt>
test   %rax,%rax
je     1169 <parse_unary+0x39>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <parse_unary@plt>
mov    %rax,0x8(%rsp)
add    $0x10,%rsp
pop    %rbx
ret
lea    0x8(%rsp),%rdi
mov    $0x2d,%esi
call   1050 <accept@plt>
mov    0x8(%rsp),%rdi
test   %rax,%rax
je     1198 <parse_unary+0x68>
mov    %rbx,%rsi
call   1040 <parse_unary@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     11a2 <parse_unary+0x72>
negl   (%rbx)
jmp    1163 <parse_unary+0x33>
mov    %rbx,%rsi
call   1030 <parse_factor@plt>
jmp    115e <parse_unary+0x2e>
xor    %eax,%eax
jmp    1163 <parse_unary+0x33>

LLVM IR (-O0):
define i8* @parse_unary(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = call i64 @accept(i8** %3, i8 signext 43)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32*, i32** %4
%10 = call i8* @parse_unary(i8* %8, i32* %9)
store i8* %10, i8** %3
br label %30
11: ; preds = %2
%12 = call i64 @accept(i8** %3, i8 signext 45)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i8*, i8** %3
%16 = load i32*, i32** %4
%17 = call i8* @parse_unary(i8* %15, i32* %16)
store i8* %17, i8** %3
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = sub nsw i32 0, %21
%23 = load i32*, i32** %4
store i32 %22, i32* %23
br label %24
24: ; preds = %19, %14
br label %29
25: ; preds = %11
%26 = load i8*, i8** %3
%27 = load i32*, i32** %4
%28 = call i8* @parse_factor(i8* %26, i32* %27)
store i8* %28, i8** %3
br label %29
29: ; preds = %25, %24
br label %30
30: ; preds = %29, %7
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
define i8* @parse_unary(i8* %0, i32* %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i64 @accept(i8** %3, i8 signext 43)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i8* @parse_unary(i8* %7, i32* %1)
store i8* %8, i8** %3
br label %21
9: ; preds = %2
%10 = call i64 @accept(i8** %3, i8 signext 45)
%11 = icmp eq i64 %10, 0
%12 = load i8*, i8** %3
br i1 %11, label %19, label %13
13: ; preds = %9
%14 = call i8* @parse_unary(i8* %12, i32* %1)
store i8* %14, i8** %3
%15 = icmp eq i8* %14, null
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = load i32, i32* %1
%18 = sub nsw i32 0, %17
store i32 %18, i32* %1
br label %21
19: ; preds = %9
%20 = call i8* @parse_factor(i8* %12, i32* %1)
store i8* %20, i8** %3
br label %21
21: ; preds = %19, %16, %13, %6
%22 = phi i8* [ %20, %19 ], [ %14, %16 ], [ null, %13 ], [ %8, %6 ]
ret i8* %22
}