// File: /workspace/github_c_makefile_star2_O3/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
movq %rdx, -0x48(%rsp)
movslq %edx, %rbx
movslq %esi, %rax
movq %rax, -0x40(%rsp)
movl $0x2, %r12d
movl $0xfffffffe, %r9d       # imm = 0xFFFFFFFE
leaq (%r12,%rbx), %r10
leaq (%r12,%rbx), %rax
decq %rax
movq %rax, -0x10(%rsp)
movq -0x40(%rsp), %r8
leaq (%r12,%r8), %r14
leal -0x1(%r14), %ecx
movl %ecx, %eax
shrl $0x6, %eax
movq %rax, -0x20(%rsp)
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq %rdx, %r11
shrq %cl, %r11
movq %r11, -0x28(%rsp)
movq %rbx, %rcx
subq %r12, %rcx
movq %rcx, -0x60(%rsp)
subq %r12, %r8
movq %rdx, %rax
movq %r14, %rdx
movl %r8d, %ecx
shrq %cl, %rax
movq %rax, -0x30(%rsp)
movl %r8d, %eax
shrl $0x6, %eax
movq %rax, -0x38(%rsp)
movl %r9d, -0x54(%rsp)
movl %r9d, %r13d
xorl %ebp, %ebp
movq %r14, -0x50(%rsp)
movq %r10, -0x8(%rsp)
movq %r12, -0x18(%rsp)
movq %r8, %rax
leal (%rsi,%r13), %r8d
movl %r8d, %ecx
incl %ecx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
js 0x1d40c
testq %r10, %r10
setle %r9b
cmpl (%rdi), %ecx
setge %r11b
orb %r9b, %r11b
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
jne 0x1d40c
movslq 0x4(%rdi), %r11
cmpq %r11, %r10
jg 0x1d40c
movslq 0x8(%rdi), %r9
imulq -0x10(%rsp), %r9
shlq $0x3, %r9
addq 0x10(%rdi), %r9
movl %ecx, %r11d
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
shrq %cl, %r14
shrl $0x6, %r11d
andq (%r9,%r11,8), %r14
cmpq $0x1, %r14
movl $0x0, %r9d
sbbl %r9d, %r9d
orl $0x1, %r9d
testq %rdx, %rdx
jle 0x1d465
movslq (%rdi), %r11
cmpq %r11, %rdx
jg 0x1d465
leal (%rbx,%r13), %r11d
incl %r11d
testl %r11d, %r11d
jle 0x1d465
cmpl 0x4(%rdi), %r11d
jg 0x1d465
movq -0x48(%rsp), %r11
addl %r13d, %r11d
movl %r11d, %r11d
movslq 0x8(%rdi), %r14
imulq %r11, %r14
shlq $0x3, %r14
addq 0x10(%rdi), %r14
movq -0x20(%rsp), %r11
movq (%r14,%r11,8), %r11
andq -0x28(%rsp), %r11
cmpq $0x1, %r11
movl $0x0, %r15d
sbbl %r15d, %r15d
orl $0x1, %r15d
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x1d4ec
cmpq $0x0, -0x60(%rsp)
sets %r14b
cmpl (%rdi), %ecx
setg %cl
orb %r14b, %cl
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jne 0x1d4ec
movslq 0x4(%rdi), %rcx
cmpq %rcx, -0x60(%rsp)
jge 0x1d4ec
movslq 0x8(%rdi), %r14
imulq -0x60(%rsp), %r14
shlq $0x3, %r14
addq 0x10(%rdi), %r14
movl %r8d, %edx
movq %rsi, %r10
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movl %r8d, %ecx
shrq %cl, %rsi
shrl $0x6, %edx
andq (%r14,%rdx,8), %rsi
movq -0x50(%rsp), %rdx
cmpq $0x1, %rsi
movq %r10, %rsi
movq -0x18(%rsp), %r12
movq -0x8(%rsp), %r10
movl $0x0, %r14d
sbbl %r14d, %r14d
orl $0x1, %r14d
movq %rax, %r8
testq %rax, %rax
js 0x1d544
movslq (%rdi), %rcx
cmpq %rcx, %r8
jge 0x1d544
movq -0x48(%rsp), %rax
leal (%rax,%r13), %ecx
incl %ecx
js 0x1d544
cmpl 0x4(%rdi), %ecx
jge 0x1d544
movl %ecx, %ecx
movslq 0x8(%rdi), %rdx
imulq %rcx, %rdx
shlq $0x3, %rdx
addq 0x10(%rdi), %rdx
movq -0x38(%rsp), %rax
movq (%rdx,%rax,8), %rcx
movq -0x50(%rsp), %rdx
andq -0x30(%rsp), %rcx
cmpq $0x1, %rcx
movl $0x0, %r11d
sbbl %r11d, %r11d
orl $0x1, %r11d
addl %ebp, %r9d
addl %r15d, %r9d
addl %r14d, %r9d
movl %r9d, %ebp
addl %r11d, %ebp
leal 0x2(%r13), %ecx
incl %r13d
cmpq %rcx, %r12
jne 0x1d396
testl %ebp, %ebp
jg 0x1d584
xorl %eax, %eax
testl %ebp, %ebp
jne 0x1d589
incq %r12
movl -0x54(%rsp), %r9d
decl %r9d
cmpq $0x5, %r12
jne 0x1d317
jmp 0x1d589
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq