#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 SIGINT 130
int SIGKILL;
#define SIGQUIT 129
#define SIGUSR1 128
int SIGUSR2;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getppid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
void seller(int sign_no) {
  switch (sign_no) {
  case SIGINT:
    kill(getppid(), SIGUSR1);
    break;
  case SIGQUIT:
    kill(getppid(), SIGUSR2);
    break;
  case SIGUSR1:
    printf("all get off the bus");
    kill(getppid(), SIGKILL);
    exit(0);
    break;
  default:
    break;
  }
}


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     11bb <seller+0x7b>
jmp    1161 <seller+0x21>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
je     119f <seller+0x5f>
jmp    1174 <seller+0x34>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
jne    11e5 <seller+0xa5>
jmp    1187 <seller+0x47>
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,%edi
mov    $0x80,%esi
call   1040 <kill@plt>
jmp    11ea <seller+0xaa>
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,%edi
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
jmp    11ea <seller+0xaa>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %eax,%edi
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
xor    %edi,%edi
call   1060 <exit@plt>
jmp    11ea <seller+0xaa>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seller>:
push   %rax
cmp    $0x81,%edi
je     115b <seller+0x1b>
cmp    $0x82,%edi
je     1173 <seller+0x33>
cmp    $0x80,%edi
je     1187 <seller+0x47>
pop    %rax
ret
xor    %eax,%eax
call   1050 <getppid@plt>
mov    0x2e77(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
pop    %rax
jmp    1040 <kill@plt>
xor    %eax,%eax
call   1050 <getppid@plt>
mov    %eax,%edi
mov    $0x80,%esi
pop    %rax
jmp    1040 <kill@plt>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getppid@plt>
mov    0x2e37(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <kill@plt>
xor    %edi,%edi
call   1060 <exit@plt>

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

LLVM IR (-O2):
@SIGUSR2 = global i32 0
@.str = [20 x i8] c"all get off the bus\00"
@SIGKILL = global i32 0
define void @seller(i32 %0) {
switch i32 %0, label %15 [
i32 130, label %2
i32 129, label %5
i32 128, label %9
]
2: ; preds = %1
%3 = tail call i32 (...) @getppid()
%4 = tail call i32 @kill(i32 %3, i32 128)
br label %15
5: ; preds = %1
%6 = tail call i32 (...) @getppid()
%7 = load i32, i32* @SIGUSR2
%8 = tail call i32 @kill(i32 %6, i32 %7)
br label %15
9: ; preds = %1
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 (...) @getppid()
%12 = load i32, i32* @SIGKILL
%13 = tail call i32 @kill(i32 %11, i32 %12)
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %1, %5, %2
ret void
}