// File: /workspace/github_c_makefile_star2_O2/voithos[P]awl/src/mpc.c
// Function: mpc_err_or
static mpc_err_t *mpc_err_or(mpc_err_t** x, int n) {
  
  int i, j;
  mpc_err_t *e = malloc(sizeof(mpc_err_t));
  e->state = mpc_state_invalid();
  e->expected_num = 0;
  e->expected = NULL;
  e->failure = NULL;
  e->filename = malloc(strlen(x[0]->filename)+1);
  strcpy(e->filename, x[0]->filename);
  
  for (i = 0; i < n; i++) {
    if (x[i]->state.pos > e->state.pos) { e->state = x[i]->state; }
  }
  
  for (i = 0; i < n; i++) {
    
    if (x[i]->state.pos < e->state.pos) { continue; }
    
    if (x[i]->failure) {
      e->failure = malloc(strlen(x[i]->failure)+1);
      strcpy(e->failure, x[i]->failure);
      break;
    }
    
    e->recieved = x[i]->recieved;
    
    for (j = 0; j < x[i]->expected_num; j++) {
      if (!mpc_err_contains_expected(e, x[i]->expected[j])) { mpc_err_add_expected(e, x[i]->expected[j]); }
    }
  }
  
  for (i = 0; i < n; i++) {
    mpc_err_delete(x[i]);
  }
  
  return e;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r14d
movq %rdi, %rbx
pushq $0x30
popq %rdi
callq 0x2290
movq %rax, %r15
orq $-0x1, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x8(%r15)
leaq 0x18(%r15), %rax
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r15)
movq %rbx, 0x10(%rsp)
movq (%rbx), %rax
movq 0x10(%rax), %r12
movq %r12, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq %r15, 0x8(%rsp)
movq %rax, 0x10(%r15)
movq %rax, %rdi
movq %r12, %rsi
callq 0x2080
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
cmpq %rax, %r14
je 0xc484
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rcx
movl (%rcx), %edx
movq 0x8(%rsp), %rsi
cmpl (%rsi), %edx
jle 0xc47f
movl 0x8(%rcx), %edx
movq 0x8(%rsp), %rsi
movl %edx, 0x8(%rsi)
movq (%rcx), %rcx
movq %rcx, (%rsi)
incq %rax
jmp 0xc455
xorl %r12d, %r12d
xorl %esi, %esi
xorl %ecx, %ecx
movq %r14, 0x28(%rsp)
cmpq %r14, %rcx
je 0xc5b7
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rsp)
movq (%rax,%rcx,8), %rdx
movl (%rdx), %eax
movq 0x8(%rsp), %rcx
cmpl (%rcx), %eax
jl 0xc586
movq 0x18(%rdx), %r13
testq %r13, %r13
jne 0xc593
movb 0x28(%rdx), %al
movq 0x8(%rsp), %rcx
movb %al, 0x28(%rcx)
xorl %r14d, %r14d
movslq 0xc(%rdx), %rax
cmpq %rax, %r14
jge 0xc581
movq %rdx, 0x30(%rsp)
movq 0x20(%rdx), %rax
movq (%rax,%r14,8), %r13
testl %esi, %esi
movl $0x0, %r15d
movq %rsi, %rbp
cmovgl %esi, %r15d
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0xc51e
movq (%r12,%rbx,8), %rdi
movq %r13, %rsi
callq 0x2210
incq %rbx
testl %eax, %eax
jne 0xc4fc
movq %rbp, %rsi
movq 0x30(%rsp), %rdx
jmp 0xc579
movq %rbp, %rax
leal 0x1(%rbp), %r15d
movq 0x8(%rsp), %rbp
movl %r15d, 0xc(%rbp)
movslq %eax, %rbx
leaq 0x8(,%rbx,8), %rsi
movq %r12, %rdi
callq 0x22e0
movq %rax, %r12
movq %rax, 0x20(%rbp)
movq %r13, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq %rax, (%r12,%rbx,8)
movq %rax, %rdi
movq %r13, %rsi
callq 0x2080
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movl %r15d, %esi
incq %r14
jmp 0xc4d1
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %rcx
incq %rcx
jmp 0xc490
movq %r13, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq %rax, %rdi
movq %r13, %rsi
callq 0x2080
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0xc5d1
movq 0x10(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x6dec
incq %rbx
jmp 0xc5b9
movq 0x8(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq