// File: /workspace/github_c_makefile_star2_O2/yui0[P]img2vec/./potracelib.h
// Function: majority
static int majority(potrace_bitmap_t *bm, int x, int y) {
  int i, a, ct;
  for (i=2; i<5; i++) { /* check at "radius" i */
    ct = 0;
    for (a=-i+1; a<=i-1; a++) {
      ct += BM_GET(bm, x+a, y+i-1) ? 1 : -1;
      ct += BM_GET(bm, x+i-1, y+a-1) ? 1 : -1;
      ct += BM_GET(bm, x+a-1, y-i) ? 1 : -1;
      ct += BM_GET(bm, x-i, y+a) ? 1 : -1;
    }
    if (ct>0) {
      return 1;
    } else if (ct<0) {
      return 0;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, -0x44(%rsp)
movslq %esi, %rax
movq %rax, -0x38(%rsp)
movq %rdx, -0x30(%rsp)
movslq %edx, %rax
movq %rax, -0x40(%rsp)
movabsq $0x2, %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpq $0x5, %r14
je 0x18cf7
movq -0x40(%rsp), %r11
leaq (%r14,%r11), %rsi
leaq (%r14,%r11), %rax
decq %rax
movq %rax, -0x8(%rsp)
movq -0x38(%rsp), %r8
leaq (%r14,%r8), %r13
leal -0x1(%r13), %ecx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, %rdx
shrq %cl, %rdx
movq %rdx, -0x10(%rsp)
shrl $0x6, %ecx
movq %rcx, -0x18(%rsp)
subq %r14, %r11
subq %r14, %r8
movl %r8d, %edx
movl %r8d, %ecx
shrq %cl, %rax
movq %rax, -0x28(%rsp)
shrl $0x6, %edx
movq %rdx, -0x20(%rsp)
movl $0x1, %eax
movl %eax, %r9d
subl %r14d, %r9d
xorl %eax, %eax
movl %r9d, %ecx
cmpq %rcx, %r14
je 0x18ce8
movl -0x44(%rsp), %ecx
addl %r9d, %ecx
movl %r12d, %ebp
js 0x18bac
testq %rsi, %rsi
setle %r10b
cmpl (%rdi), %ecx
setge %bl
orb %r10b, %bl
movl %r12d, %ebp
jne 0x18bac
movslq 0x4(%rdi), %r10
movl %r12d, %ebp
cmpq %r10, %rsi
jg 0x18bac
movslq 0x8(%rdi), %r10
imulq -0x8(%rsp), %r10
shlq $0x3, %r10
addq 0x10(%rdi), %r10
movl %ecx, %ebx
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
shrq %cl, %r15
shrl $0x6, %ebx
andq (%r10,%rbx,8), %r15
cmpq $0x1, %r15
movl $0x0, %ebp
sbbl %ebp, %ebp
orl $0x1, %ebp
movl %r12d, %r10d
testq %r13, %r13
jle 0x18c15
movslq (%rdi), %rbx
movl %r12d, %r10d
cmpq %rbx, %r13
jg 0x18c15
movq -0x30(%rsp), %rdx
leal (%rdx,%r9), %ebx
movl %r12d, %r10d
testl %ebx, %ebx
jle 0x18c15
movl %r12d, %r10d
cmpl 0x4(%rdi), %ebx
jg 0x18c15
movq -0x40(%rsp), %rdx
leal (%rdx,%r9), %r10d
decl %r10d
movl %r10d, %r10d
movslq 0x8(%rdi), %rbx
imulq %r10, %rbx
shlq $0x3, %rbx
addq 0x10(%rdi), %rbx
movq -0x18(%rsp), %rdx
movq (%rbx,%rdx,8), %r10
andq -0x10(%rsp), %r10
cmpq $0x1, %r10
movl $0x0, %r10d
sbbl %r10d, %r10d
orl $0x1, %r10d
movl %r12d, %ebx
testl %ecx, %ecx
jle 0x18c7a
testq %r11, %r11
sets %bl
cmpl (%rdi), %ecx
setg %cl
orb %bl, %cl
movl %r12d, %ebx
jne 0x18c7a
movslq 0x4(%rdi), %rcx
movl %r12d, %ebx
cmpq %rcx, %r11
jge 0x18c7a
movq -0x38(%rsp), %rcx
addl %r9d, %ecx
decl %ecx
movslq 0x8(%rdi), %rbx
imulq %r11, %rbx
shlq $0x3, %rbx
addq 0x10(%rdi), %rbx
movl %ecx, %r15d
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
shrq %cl, %rdx
shrl $0x6, %r15d
andq (%rbx,%r15,8), %rdx
cmpq $0x1, %rdx
movl $0x0, %ebx
sbbl %ebx, %ebx
orl $0x1, %ebx
movl %r12d, %ecx
testq %r8, %r8
js 0x18cd5
movslq (%rdi), %rdx
movl %r12d, %ecx
cmpq %rdx, %r8
jge 0x18cd5
movq -0x30(%rsp), %rcx
movl %ecx, %r15d
addl %r9d, %r15d
movl %r12d, %ecx
js 0x18cd5
movl %r12d, %ecx
cmpl 0x4(%rdi), %r15d
jge 0x18cd5
movl %r15d, %ecx
movslq 0x8(%rdi), %rdx
imulq %rcx, %rdx
shlq $0x3, %rdx
addq 0x10(%rdi), %rdx
movq -0x20(%rsp), %rcx
movq (%rdx,%rcx,8), %rcx
andq -0x28(%rsp), %rcx
cmpq $0x1, %rcx
movl $0x0, %ecx
sbbl %ecx, %ecx
orl $0x1, %ecx
addl %eax, %ebp
addl %r10d, %ebp
addl %ebx, %ebp
addl %ecx, %ebp
incl %r9d
movl %ebp, %eax
jmp 0x18b3e
testl %eax, %eax
jg 0x18cfb
incq %r14
testl %eax, %eax
jns 0x18acc
xorl %eax, %eax
jmp 0x18d00
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq