// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/lbs/worker.c
// Function: worker_kill
int
worker_kill(struct workctl * ctl)
{
	int rc;

	/* Lock the control structure. */
	if ((rc = pthread_mutex_lock(&ctl->mtx)) != 0) {
		warn0("pthread_mutex_lock: %s", strerror(rc));
		goto err0;
	}

	/* Tell the thread to die, and wake it up. */
	ctl->suicide = 1;
	if ((rc = pthread_cond_signal(&ctl->cv)) != 0) {
		warn0("pthread_cond_signal: %s", strerror(rc));
		goto err1;
	}

	/* Unlock the control structure. */
	if ((rc = pthread_mutex_unlock(&ctl->mtx)) != 0) {
		warn0("pthread_mutex_unlock: %s", strerror(rc));
		goto err0;
	}

	/* Wait for the thread to die. */
	if ((rc = pthread_join(ctl->thr, NULL)) != 0) {
		warn0("pthread_join: %s", strerror(rc));
		goto err0;
	}

	/* Destroy condition variable. */
	if ((rc = pthread_cond_destroy(&ctl->cv)) != 0) {
		warn0("pthread_cond_destroy: %s", strerror(rc));
		goto err0;
	}

	/* Destroy mutex. */
	if ((rc = pthread_mutex_destroy(&ctl->mtx)) != 0) {
		warn0("pthread_mutex_destroy: %s", strerror(rc));
		goto err0;
	}

	/* Free the control structure. */
	free(ctl);

	/* Success! */
	return (0);

err1:
	pthread_mutex_unlock(&ctl->mtx);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2560
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x5758
jmp 0x572f
movl -0x14(%rbp), %edi
callq 0x2530
movq %rax, %rsi
leaq 0xd1a5(%rip), %rdi      # 0x128e6
movb $0x0, %al
callq 0xf2c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x58b4
movq -0x10(%rbp), %rax
movl $0x1, 0x68(%rax)
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
callq 0x22f0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x57a3
jmp 0x577a
movl -0x14(%rbp), %edi
callq 0x2530
movq %rax, %rsi
leaq 0xd21e(%rip), %rdi      # 0x129aa
movb $0x0, %al
callq 0xf2c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x58ab
movq -0x10(%rbp), %rdi
callq 0x2390
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x57df
jmp 0x57b6
movl -0x14(%rbp), %edi
callq 0x2530
movq %rax, %rsi
leaq 0xd15e(%rip), %rdi      # 0x12926
movb $0x0, %al
callq 0xf2c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x58b4
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2510
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x5823
jmp 0x57fa
movl -0x14(%rbp), %edi
callq 0x2530
movq %rax, %rsi
leaq 0xd235(%rip), %rdi      # 0x12a41
movb $0x0, %al
callq 0xf2c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x58b4
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
callq 0x2470
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x5860
jmp 0x583a
movl -0x14(%rbp), %edi
callq 0x2530
movq %rax, %rsi
leaq 0xd206(%rip), %rdi      # 0x12a52
movb $0x0, %al
callq 0xf2c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x58b4
movq -0x10(%rbp), %rdi
callq 0x21f0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x5899
jmp 0x5873
movl -0x14(%rbp), %edi
callq 0x2530
movq %rax, %rsi
leaq 0xd1e6(%rip), %rdi      # 0x12a6b
movb $0x0, %al
callq 0xf2c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x58b4
movq -0x10(%rbp), %rdi
callq 0x2040
movl $0x0, -0x4(%rbp)
jmp 0x58bb
movq -0x10(%rbp), %rdi
callq 0x2390
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop