#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 */

/* Variables and functions */
#define SIGHUP 130
#define SIGINT 129
#define SIGQUIT 128
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getppid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void seller(int sig) {
  switch (sig) {
  case SIGHUP:
    kill(getppid(), SIGUSR1);
    break;
  case SIGINT:
    kill(getppid(), SIGUSR2);
    break;
  case SIGQUIT:
    fprintf(stderr, "seller: All of you get off the bus!\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<seller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x80,%eax
je     11bf <seller+0x7f>
jmp    1161 <seller+0x21>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
je     11a3 <seller+0x63>
jmp    1174 <seller+0x34>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
jne    11db <seller+0x9b>
jmp    1187 <seller+0x47>
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,%edi
mov    0x2e51(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
jmp    11db <seller+0x9b>
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,%edi
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
jmp    11db <seller+0x9b>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seller>:
push   %rbx
cmp    $0x81,%edi
je     115b <seller+0x1b>
cmp    $0x82,%edi
je     1164 <seller+0x24>
cmp    $0x80,%edi
je     117c <seller+0x3c>
pop    %rbx
ret
mov    0x2e6e(%rip),%rbx
jmp    116b <seller+0x2b>
mov    0x2e7d(%rip),%rbx
xor    %eax,%eax
call   1050 <getppid@plt>
mov    (%rbx),%esi
mov    %eax,%edi
pop    %rbx
jmp    1040 <kill@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"seller: All of you get off the bus!\0A\00"
define void @seller(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 130, label %4
i32 129, label %8
i32 128, label %12
]
4: ; preds = %1
%5 = call i32 (...) @getppid()
%6 = load i32, i32* @SIGUSR1
%7 = call i32 @kill(i32 %5, i32 %6)
br label %16
8: ; preds = %1
%9 = call i32 (...) @getppid()
%10 = load i32, i32* @SIGUSR2
%11 = call i32 @kill(i32 %9, i32 %10)
br label %16
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %1, %8, %4
ret void
}

LLVM IR (-O2):
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"seller: All of you get off the bus!\0A\00"
define void @seller(i32 %0) {
switch i32 %0, label %12 [
i32 130, label %7
i32 129, label %2
i32 128, label %3
]
2: ; preds = %1
br label %7
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1, %2
%8 = phi i32* [ @SIGUSR2, %2 ], [ @SIGUSR1, %1 ]
%9 = tail call i32 (...) @getppid()
%10 = load i32, i32* %8
%11 = tail call i32 @kill(i32 %9, i32 %10)
br label %12
12: ; preds = %7, %1
ret void
}