// File: /workspace/github_cpp_makefile_star2_O3/mniip[P]sandbox/wakeup.cpp
// Function: kill_session()
void kill_session()
{
	int server = socket(AF_UNIX, SOCK_STREAM, 0);
	if(server < 0)
		panic_errno("socket");
	
	struct sockaddr_un addr;
	memset(&addr, 0, sizeof addr);
	addr.sun_family = AF_UNIX;
	strncpy(addr.sun_path, (conf_sockdir + "/socket_" + ident).c_str(), sizeof addr.sun_path - 1);
	if(connect(server, (struct sockaddr *)&addr, sizeof addr))
	{
		if(errno == ENOENT)
			return;
		int err = errno;
		unlink(("socket_" + std::string(ident)).c_str());
		errno = err;
		panic_errno("connect");
	}

	unlink((conf_sockdir + "/socket_" + ident).c_str());

	struct ucred creds;
	socklen_t len = sizeof creds;
	if(getsockopt(server, SOL_SOCKET, SO_PEERCRED, &creds, &len))
		panic_errno("getsockopt SO_PEERCRED");
	if(kill(creds.pid, SIGTERM))
		panic_errno("kill");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40d0
movl %eax, %ebx
testl %eax, %eax
jns 0xbc88
leaq 0xb8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2d05(%rip), %rsi      # 0xe951
leaq 0x2d04(%rip), %rdx      # 0xe957
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
callq 0x9234
movq %r14, %rdi
callq 0xa3cc
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbc88
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x43e0
xorps %xmm0, %xmm0
movups %xmm0, 0x128(%rsp)
movups %xmm0, 0x11c(%rsp)
movups %xmm0, 0x10c(%rsp)
movups %xmm0, 0xfc(%rsp)
movups %xmm0, 0xec(%rsp)
movups %xmm0, 0xdc(%rsp)
movups %xmm0, 0xcc(%rsp)
movw $0x1, 0xca(%rsp)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x78eb(%rip), %r13      # 0x135c8
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x8eda
leaq 0x2c5c(%rip), %rsi      # 0xe958
movq %r14, %rdi
callq 0x47c0
movq 0x7765(%rip), %rsi      # 0x13470
leaq 0x8(%rsp), %rdi
callq 0x47c0
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbd3d
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xbd45
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xcc(%rsp), %rdi
movq 0x28(%rsp), %r14
movl $0x6b, %edx
movq %r14, %rsi
callq 0x4200
cmpq %r12, %r14
je 0xbd8c
movq 0x38(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x43e0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbda3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0xca(%rsp), %rsi
movl %ebx, %edi
movl $0x6e, %edx
callq 0x4340
testl %eax, %eax
je 0xbed2
callq 0x4050
movl (%rax), %ebp
cmpl $0x2, %ebp
je 0xc042
movq %rax, %r14
movq 0x7697(%rip), %rsi      # 0x13470
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x55d4
leaq 0x2b6a(%rip), %rcx      # 0xe959
leaq 0x8(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4450
movq %r12, 0x28(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbe26
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xbe2e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
callq 0x41d0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0xbe67
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x43e0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbe7e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
movl %ebp, (%r14)
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2ae0(%rip), %rsi      # 0xe974
leaq 0x2ae0(%rip), %rdx      # 0xe97b
leaq 0x88(%rsp), %rdi
callq 0x9234
leaq 0x88(%rsp), %rdi
callq 0xa3cc
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0xbed2
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x8(%rsp), %r14
movq %r15, (%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x8eda
leaq 0x2a64(%rip), %rsi      # 0xe958
movq %r14, %rdi
callq 0x47c0
movq 0x756d(%rip), %rsi      # 0x13470
leaq 0x8(%rsp), %rdi
callq 0x47c0
movq %r12, 0x28(%rsp)
movq (%rax), %rdi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdi
je 0xbf30
movq %rdi, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xbf3b
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %r12, %rdi
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0x41d0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0xbf6f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x43e0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbf86
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x8(%rsp), %r8
movl $0xc, (%r8)
leaq 0x28(%rsp), %rcx
movl %ebx, %edi
movl $0x1, %esi
movl $0x11, %edx
callq 0x42f0
testl %eax, %eax
je 0xbfee
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x29c0(%rip), %rsi      # 0xe97c
leaq 0x29cf(%rip), %rdx      # 0xe992
leaq 0x68(%rsp), %rdi
callq 0x9234
leaq 0x68(%rsp), %rdi
callq 0xa3cc
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xbfee
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x43e0
movl 0x28(%rsp), %edi
movl $0xf, %esi
callq 0x45a0
testl %eax, %eax
je 0xc042
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x24f7(%rip), %rsi      # 0xe507
leaq 0x24f4(%rip), %rdx      # 0xe50b
leaq 0x48(%rsp), %rdi
callq 0x9234
leaq 0x48(%rsp), %rdi
callq 0xa3cc
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0xc042
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x43e0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0xc0dd
movq 0x98(%rsp), %rsi
jmp 0xc0d5
jmp 0xc0b8
jmp 0xc0c3
jmp 0xc0b8
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r15, %rdi
je 0xc0dd
movq 0xb8(%rsp), %rsi
jmp 0xc0d5
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0xc0dd
movq 0x58(%rsp), %rsi
jmp 0xc0d5
jmp 0xc0b8
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0xc0dd
movq 0x78(%rsp), %rsi
jmp 0xc0d5
movq %rax, %rbx
jmp 0xc0dd
jmp 0xc0c3
jmp 0xc0c3
jmp 0xc0c3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0xc0dd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x43e0
movq %rbx, %rdi
callq 0x4770