#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 */
int /*<<< orphan*/ SIGSTOP;
int /*<<< orphan*/ SYS_getpid;
int /*<<< orphan*/ SYS_getppid;
int /*<<< orphan*/ SYS_kill;
int /*<<< orphan*/ getpid();
scalar_t__ syscall(int /*<<< orphan*/, long, ...);
void *stub1(long number, ...) {
  syscall(SYS_kill, getpid(), SIGSTOP);
  syscall(SYS_getpid, number);
  return (void *)syscall(SYS_getppid, 0, 1, 2, 3, 4, 5);
}


x86 assembly (clang, -O0):
<stub1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
mov    %al,-0x9(%rbp)
call   1030 <getpid@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%ecx
mov    -0x9(%rbp),%al
movslq %ecx,%rsi
mov    0x2e71(%rip),%rcx
mov    (%rcx),%edx
call   1040 <syscall@plt>
mov    -0x9(%rbp),%al
mov    0x2e80(%rip),%rcx
mov    (%rcx),%edi
mov    -0x8(%rbp),%rsi
call   1040 <syscall@plt>
mov    -0x10(%rbp),%ecx
mov    -0x9(%rbp),%al
mov    0x2e58(%rip),%rdx
mov    (%rdx),%edi
mov    %rsp,%rdx
movl   $0x5,(%rdx)
mov    %ecx,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
mov    $0x4,%r9d
call   1040 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stub1>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ecb(%rip),%rax
mov    (%rax),%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
movslq %eax,%rsi
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1040 <syscall@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <syscall@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
movl   $0x5,(%rsp)
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
mov    $0x4,%r9d
xor    %eax,%eax
call   1040 <syscall@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SYS_kill = global i32 0
@SIGSTOP = global i32 0
@SYS_getpid = global i32 0
@SYS_getppid = global i32 0
define i8* @stub1(i64 %0, ...) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i32, i32* @SYS_kill
%4 = call i32 (...) @getpid()
%5 = sext i32 %4 to i64
%6 = load i32, i32* @SIGSTOP
%7 = call i64 (i32, i64, ...) @syscall(i32 %3, i64 %5, i32 %6)
%8 = load i32, i32* @SYS_getpid
%9 = load i64, i64* %2
%10 = call i64 (i32, i64, ...) @syscall(i32 %8, i64 %9)
%11 = load i32, i32* @SYS_getppid
%12 = call i64 (i32, i64, ...) @syscall(i32 %11, i64 0, i32 1, i32 2, i32 3, i32 4, i32 5)
%13 = inttoptr i64 %12 to i8*
ret i8* %13
}

LLVM IR (-O2):
@SYS_kill = global i32 0
@SIGSTOP = global i32 0
@SYS_getpid = global i32 0
@SYS_getppid = global i32 0
define i8* @stub1(i64 %0, ...) {
%2 = load i32, i32* @SYS_kill
%3 = tail call i32 (...) @getpid()
%4 = sext i32 %3 to i64
%5 = load i32, i32* @SIGSTOP
%6 = tail call i64 (i32, i64, ...) @syscall(i32 %2, i64 %4, i32 %5)
%7 = load i32, i32* @SYS_getpid
%8 = tail call i64 (i32, i64, ...) @syscall(i32 %7, i64 %0)
%9 = load i32, i32* @SYS_getppid
%10 = tail call i64 (i32, i64, ...) @syscall(i32 %9, i64 0, i32 1, i32 2, i32 3, i32 4, i32 5)
%11 = inttoptr i64 %10 to i8*
ret i8* %11
}