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

/* Variables and functions */
struct expression const *expr_generic();
struct expression const *expr_unary_minus(struct expression const *);
int /*<<< orphan*/ internal_error(char *, char);
const struct expression *expr_unary(char c, const struct expression *e) {
  switch (c) {
  case '-':
    return expr_unary_minus(e);
    break;
  default:
    internal_error("unary operator '%c' not implemented\n", c);
    break;
  }
  return expr_generic();
}


x86 assembly (clang, -O0):
<expr_unary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x9(%rbp),%al
sub    $0x2d,%al
jne    1164 <expr_unary+0x34>
jmp    1152 <expr_unary+0x22>
mov    -0x18(%rbp),%rdi
call   1040 <expr_unary_minus@plt>
mov    %rax,-0x8(%rbp)
jmp    117f <expr_unary+0x4f>
lea    0xe95(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1050 <internal_error@plt>
mov    $0x0,%al
call   1030 <expr_generic@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expr_unary>:
cmp    $0x2d,%dil
jne    113e <expr_unary+0xe>
mov    %rsi,%rdi
jmp    1040 <expr_unary_minus@plt>
push   %rax
movsbl %dil,%esi
lea    0xeb6(%rip),%rdi
call   1050 <internal_error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <expr_generic@plt>

LLVM IR (-O0):
%struct.expression = type { i32 }
@.str = [37 x i8] c"unary operator '%c' not implemented\0A\00"
define %struct.expression* @expr_unary(i8 signext %0, %struct.expression* %1) {
%3 = alloca %struct.expression*
%4 = alloca i8
%5 = alloca %struct.expression*
store i8 %0, i8* %4
store %struct.expression* %1, %struct.expression** %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %11 [
i32 45, label %8
]
8: ; preds = %2
%9 = load %struct.expression*, %struct.expression** %5
%10 = call %struct.expression* @expr_unary_minus(%struct.expression* %9)
store %struct.expression* %10, %struct.expression** %3
br label %16
11: ; preds = %2
%12 = load i8, i8* %4
%13 = call i32 @internal_error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8 signext %12)
br label %14
14: ; preds = %11
%15 = call %struct.expression* (...) @expr_generic()
store %struct.expression* %15, %struct.expression** %3
br label %16
16: ; preds = %14, %8
%17 = load %struct.expression*, %struct.expression** %3
ret %struct.expression* %17
}

LLVM IR (-O2):
%struct.expression = type { i32 }
@.str = [37 x i8] c"unary operator '%c' not implemented\0A\00"
define %struct.expression* @expr_unary(i8 signext %0, %struct.expression* %1) {
%3 = icmp eq i8 %0, 45
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call %struct.expression* @expr_unary_minus(%struct.expression* %1)
br label %9
6: ; preds = %2
%7 = tail call i32 @internal_error(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%8 = tail call %struct.expression* (...) @expr_generic()
br label %9
9: ; preds = %6, %4
%10 = phi %struct.expression* [ %5, %4 ], [ %8, %6 ]
ret %struct.expression* %10
}