// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/multithread.c
// Function: gt_multithread
int gt_multithread(GtThreadFunc function, void *data, GtError *err)
{
  GtArray *threads;
  GtThread *thread;
  unsigned int i, j;

  gt_error_check(err);
  gt_assert(function);

  threads = gt_array_new(sizeof (GtThread*));

  /* start all other threads and store them */
  for (i = 1; i < gt_jobs; i++) {
    if (!(thread = gt_thread_new(function, data, err))) {
      for (j = 0; j < gt_array_size(threads); j++)
        gt_thread_delete(*(GtThread**) gt_array_get(threads, j));
      gt_array_delete(threads);
      return -1;
    }
    gt_array_add(threads, thread);
  }

  function(data); /* execute function in main thread, too */

  /* wait until all other threads are finished */
  for (i = 0; i < gt_array_size(threads); i++) {
    thread = *(GtThread**) gt_array_get(threads, i);
    gt_thread_join(thread);
    gt_thread_delete(thread);
  }
  gt_array_delete(threads);

  return 0;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0xe723
movq 0x28(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0xe6eb
jmp 0xe723
movq 0x1a58e6(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x14f96a(%rip), %rsi    # 0x15e066
leaq 0x14ff45(%rip), %rdx    # 0x15e648
leaq 0x1500cb(%rip), %rcx    # 0x15e7d5
leaq 0x1500d3(%rip), %r8     # 0x15e7e4
movl $0x1d, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xe725
jmp 0xe727
cmpq $0x0, 0x38(%rsp)
jne 0xe767
movq 0x1a58a2(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x14f926(%rip), %rsi    # 0x15e066
leaq 0x15d7dd(%rip), %rdx    # 0x16bf24
leaq 0x150087(%rip), %rcx    # 0x15e7d5
leaq 0x15008f(%rip), %r8     # 0x15e7e4
movl $0x1e, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xe769
movl $0x8, %edi
callq 0x75ab0
movq %rax, 0x20(%rsp)
movl $0x1, 0x14(%rsp)
movl 0x14(%rsp), %eax
leaq 0x1a5f39(%rip), %rcx    # 0x1b46c4
cmpl (%rcx), %eax
jae 0xe83a
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x1bcc0
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
jne 0xe816
movl $0x0, 0x10(%rsp)
movl 0x10(%rsp), %eax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
callq 0x76490
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0xe7ff
movq 0x20(%rsp), %rdi
movl 0x10(%rsp), %eax
movl %eax, %esi
callq 0x75c80
movq (%rax), %rdi
callq 0x1c480
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0xe7ba
movq 0x20(%rsp), %rdi
callq 0x770a0
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
jmp 0xe8b7
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xe780
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rdi
callq *%rax
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq %rax, (%rsp)
movq 0x20(%rsp), %rdi
callq 0x76490
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0xe8a5
movq 0x20(%rsp), %rdi
movl 0x14(%rsp), %eax
movl %eax, %esi
callq 0x75c80
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
callq 0x1be10
movq 0x18(%rsp), %rdi
callq 0x1c480
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xe84e
movq 0x20(%rsp), %rdi
callq 0x770a0
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq