// File: /workspace/github_cpp_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40d0
movl %eax, %ebx
testl %eax, %eax
jns 0xbe82
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x3b0b(%rip), %rsi      # 0xf951
leaq 0x3b0a(%rip), %rdx      # 0xf957
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x9376
movq %r14, %rdi
callq 0xa5a4
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0xbe82
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x43e0
xorps %xmm0, %xmm0
movaps %xmm0, 0xd0(%rsp)
movups %xmm0, 0x12e(%rsp)
movaps %xmm0, 0x120(%rsp)
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movw $0x1, 0xd0(%rsp)
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x86f1(%rip), %r13      # 0x145c8
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x8ff2
leaq 0x3a62(%rip), %rsi      # 0xf958
movq %r14, %rdi
callq 0x47c0
movq 0x856b(%rip), %rsi      # 0x14470
leaq 0x10(%rsp), %rdi
callq 0x47c0
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbf37
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0xbf3f
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xd2(%rsp), %rdi
movq 0x30(%rsp), %r14
movl $0x6b, %edx
movq %r14, %rsi
callq 0x4200
cmpq %r12, %r14
je 0xbf86
movq 0x40(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x43e0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xbf9d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0xd0(%rsp), %rsi
movl %ebx, %edi
movl $0x6e, %edx
callq 0x4340
testl %eax, %eax
je 0xc0cc
callq 0x4050
movl (%rax), %ebp
cmpl $0x2, %ebp
je 0xc244
movq %rax, %r14
movq 0x849d(%rip), %rsi      # 0x14470
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x55de
leaq 0x3970(%rip), %rcx      # 0xf959
leaq 0x10(%rsp), %rdi
movl $0x7, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4450
movq %r12, 0x30(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc020
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0xc028
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x30(%rsp), %rdi
callq 0x41d0
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0xc061
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43e0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xc078
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
movl %ebp, (%r14)
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x38e6(%rip), %rsi      # 0xf974
leaq 0x38e6(%rip), %rdx      # 0xf97b
leaq 0x90(%rsp), %rdi
callq 0x9376
leaq 0x90(%rsp), %rdi
callq 0xa5a4
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xc0cc
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x10(%rsp), %r14
movq %r15, (%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x8ff2
leaq 0x386a(%rip), %rsi      # 0xf958
movq %r14, %rdi
callq 0x47c0
movq 0x8373(%rip), %rsi      # 0x14470
leaq 0x10(%rsp), %rdi
callq 0x47c0
movq %r12, 0x30(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc12a
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0xc132
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x30(%rsp), %rdi
callq 0x41d0
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0xc16b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43e0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xc182
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
leaq 0x10(%rsp), %r8
movl $0xc, (%r8)
leaq 0x30(%rsp), %rcx
movl %ebx, %edi
movl $0x1, %esi
movl $0x11, %edx
callq 0x42f0
testl %eax, %eax
je 0xc1f0
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x37c1(%rip), %rsi      # 0xf97c
leaq 0x37d0(%rip), %rdx      # 0xf992
leaq 0x70(%rsp), %rdi
callq 0x9376
leaq 0x70(%rsp), %rdi
callq 0xa5a4
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xc1f0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x43e0
movl 0x30(%rsp), %edi
movl $0xf, %esi
callq 0x45a0
testl %eax, %eax
je 0xc244
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x32f5(%rip), %rsi      # 0xf507
leaq 0x32f2(%rip), %rdx      # 0xf50b
leaq 0x50(%rsp), %rdi
callq 0x9376
leaq 0x50(%rsp), %rdi
callq 0xa5a4
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xc244
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x43e0
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xc2e2
movq 0xa0(%rsp), %rsi
jmp 0xc2da
jmp 0xc2bd
jmp 0xc2c8
jmp 0xc2bd
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0xc2e2
movq 0xc0(%rsp), %rsi
jmp 0xc2da
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xc2e2
movq 0x60(%rsp), %rsi
jmp 0xc2da
jmp 0xc2bd
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0xc2e2
movq 0x80(%rsp), %rsi
jmp 0xc2da
movq %rax, %rbx
jmp 0xc2e2
jmp 0xc2c8
jmp 0xc2c8
jmp 0xc2c8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xc2e2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43e0
movq %rbx, %rdi
callq 0x4770