// File: /workspace/github_c_makefile_star2_O2/ryancdotorg[P]bloomslice/bloom_h160_set.c
// Function: bloom_h160_set
int32_t bloom_h160_set(uint8_t *mem, const void *h160, uint8_t n, uint64_t mask) {
  const uint16_t *S = h160;
  const uint8_t  *B = h160;
  uint32_t t;
  uint64_t h;
  int i, k;

  if (n == BFS_TYPE_LEGACY) {
    t = BH00(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH01(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH02(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH03(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH04(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH05(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH06(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH07(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH08(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH09(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH10(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH11(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH12(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH13(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH14(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH15(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH16(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH17(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH18(((uint32_t*)h160)); BLOOM_SET_BIT(t);
    t = BH19(((uint32_t*)h160)); BLOOM_SET_BIT(t);
  } else if (n == BFS_TYPE_SINGLE) {
      memcpy(mem, h160, sizeof(hash160_t));
  } else if (n > BFS_TYPE_OFFSET + hash1sN + hash2bN + hash2sN && mask > 0xffffffff) {
    k = n - (hash1sN + hash2bN + hash2sN);
    for (i = 0; i < k; ++i) {
      // compute hash
      h = ((((uint64_t)S[data3sT[i*3+0]]) << 32)|
           (((uint64_t)S[data3sT[i*3+1]]) << 16)|
           (((uint64_t)S[data3sT[i*3+2]]))) & mask;
      // set bit h of mem
      mem[(h)>>3] = mem[(h)>>3] | (1 << ((h)&7));
    }
  } else if (n > BFS_TYPE_OFFSET + hash1sN + hash2bN && mask > 0xffff && mask <= 0xffffffff) {
    k = n - (hash1sN + hash2bN);
    for (i = 0; i < k; ++i) {
      // compute hash
      h = ((((uint64_t)S[data2sT[i*2+0]]) << 16)|
           (((uint64_t)S[data2sT[i*2+1]]))) & mask;
      // set bit h of mem
      mem[(h)>>3] = mem[(h)>>3] | (1 << ((h)&7));
    }
  } else if (n > BFS_TYPE_OFFSET + hash1sN && mask > 0xff && mask <= 0xffff) {
    k = n - (hash1sN);
    for (i = 0; i < k; ++i) {
      // compute hash
      h = ((((uint64_t)B[data2bT[i*2+0]]) << 8)|
           (((uint64_t)B[data2bT[i*2+1]]))) & mask;
      // set bit h of mem
      mem[(h)>>3] = mem[(h)>>3] | (1 << ((h)&7));
    }
  } else if (n > BFS_TYPE_OFFSET && mask >= 0xff && mask <= 0xffff) {
    k = n;
    for (i = 0; i < k; ++i) {
      // compute hash
      h = ((uint64_t)S[data1sT[i]]) & mask;
      // set bit h of mem
      mem[(h)>>3] = mem[(h)>>3] | (1 << ((h)&7));
    }
  } else {
      fprintf(stderr, "bloom_h160_set failed!\n");
      return -1;
  }

  return 0;
}

// Assembly:
cmpl $0x1, %edx
je 0x52c3
testl %edx, %edx
jne 0x52d2
movl (%rsi), %ecx
movl %ecx, %edx
andb $0x7, %cl
pushq $0x1
popq %rax
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x4(%rsi), %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x8(%rsi), %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0xc(%rsi), %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x10(%rsi), %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl (%rsi), %edx
movl 0x4(%rsi), %ecx
shrdl $0x10, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x4(%rsi), %edx
movl 0x8(%rsi), %ecx
shrdl $0x10, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x8(%rsi), %edx
movl 0xc(%rsi), %ecx
shrdl $0x10, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0xc(%rsi), %edx
movl 0x10(%rsi), %ecx
shrdl $0x10, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl (%rsi), %edx
movl 0x10(%rsi), %ecx
shldl $0x10, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl (%rsi), %edx
movl 0x4(%rsi), %ecx
shrdl $0x18, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x4(%rsi), %edx
movl 0x8(%rsi), %ecx
shrdl $0x18, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x8(%rsi), %edx
movl 0xc(%rsi), %ecx
shrdl $0x18, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0xc(%rsi), %edx
movl 0x10(%rsi), %ecx
shrdl $0x18, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl (%rsi), %edx
movl 0x10(%rsi), %ecx
shldl $0x8, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl (%rsi), %edx
movl 0x4(%rsi), %ecx
shrdl $0x8, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x4(%rsi), %edx
movl 0x8(%rsi), %ecx
shrdl $0x8, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0x8(%rsi), %edx
movl 0xc(%rsi), %ecx
shrdl $0x8, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl 0xc(%rsi), %edx
movl 0x10(%rsi), %ecx
shrdl $0x8, %edx, %ecx
movl %ecx, %edx
andb $0x7, %cl
movl %eax, %r8d
shll %cl, %r8d
shrl $0x3, %edx
orb %r8b, (%rdi,%rdx)
movl (%rsi), %edx
movl 0x10(%rsi), %ecx
shldl $0x18, %edx, %ecx
movl %ecx, %edx
shrl $0x3, %edx
andb $0x7, %cl
shll %cl, %eax
orb %al, (%rdi,%rdx)
jmp 0x52cf
movl 0x10(%rsi), %eax
movl %eax, 0x10(%rdi)
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
xorl %eax, %eax
retq
pushq %rbx
movq %rcx, %r8
leaq 0x401d(%rip), %rax      # 0x92fa
movzbl (%rax), %eax
leaq 0x401e(%rip), %rcx      # 0x9305
movzbl (%rcx), %ecx
leal (%rax,%rcx), %r9d
incl %r9d
movq %r8, %r10
shrq $0x20, %r10
je 0x537e
leaq 0x3f8b(%rip), %r10      # 0x9290
movzbl (%r10), %r10d
leal (%r9,%r10), %r11d
cmpl %edx, %r11d
jae 0x537e
addl %ecx, %eax
addl %r10d, %eax
subl %eax, %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
leaq (%rdx,%rdx,2), %rdx
leaq 0x3e45(%rip), %r9       # 0x9170
xorl %r10d, %r10d
cmpq %r10, %rdx
je 0x54d0
movzbl (%r9,%r10), %ecx
movzwl (%rsi,%rcx,2), %ecx
shlq $0x20, %rcx
movzbl 0x1(%r9,%r10), %r11d
movzwl (%rsi,%r11,2), %r11d
shll $0x10, %r11d
orq %rcx, %r11
movzbl 0x2(%r9,%r10), %ecx
movzwl (%rsi,%rcx,2), %ecx
orq %r11, %rcx
andq %r8, %rcx
movq %rcx, %r11
shrq $0x3, %r11
andb $0x7, %cl
movb $0x1, %bl
shlb %cl, %bl
orb %bl, (%rdi,%r11)
addq $0x3, %r10
jmp 0x532e
cmpl %edx, %r9d
setae %r9b
leaq -0x10000(%r8), %r10
shrq $0x10, %r10
cmpq $0xffff, %r10           # imm = 0xFFFF
setae %r10b
orb %r9b, %r10b
jne 0x53f5
addl %ecx, %eax
subl %eax, %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
leaq 0x3eee(%rip), %r9       # 0x92a0
xorl %r10d, %r10d
cmpq %r10, %rdx
je 0x54d0
movzbl (%r9,%r10,2), %ecx
movzwl (%rsi,%rcx,2), %ecx
shll $0x10, %ecx
movzbl 0x1(%r9,%r10,2), %r11d
movzwl (%rsi,%r11,2), %r11d
orl %ecx, %r11d
movl %r8d, %ecx
andl %r11d, %ecx
movl %ecx, %r11d
shrl $0x3, %r11d
andb $0x7, %cl
movb $0x1, %bl
shlb %cl, %bl
orb %bl, (%rdi,%r11)
incq %r10
jmp 0x53b5
leal 0x1(%rax), %ecx
cmpl %edx, %ecx
setae %cl
leaq -0x100(%r8), %r9
cmpq $0xff00, %r9            # imm = 0xFF00
setae %r9b
orb %cl, %r9b
jne 0x5467
subl %eax, %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
leaq 0x3eec(%rip), %r9       # 0x9310
xorl %r10d, %r10d
cmpq %r10, %rdx
je 0x54d0
movzbl (%r9,%r10,2), %ecx
movzbl (%rsi,%rcx), %ecx
shll $0x8, %ecx
movzbl 0x1(%r9,%r10,2), %r11d
movzbl (%rsi,%r11), %r11d
orl %ecx, %r11d
movl %r8d, %ecx
andl %r11d, %ecx
movl %ecx, %r11d
shrl $0x3, %r11d
andb $0x7, %cl
movb $0x1, %bl
shlb %cl, %bl
orb %bl, (%rdi,%r11)
incq %r10
jmp 0x5427
leaq -0xff(%r8), %rax
cmpq $0xff00, %rax           # imm = 0xFF00
ja 0x54b1
movzbl %dl, %edx
xorl %eax, %eax
leaq 0x3e79(%rip), %r9       # 0x92fb
xorl %r10d, %r10d
cmpq %r10, %rdx
je 0x54d0
movzbl (%r9,%r10), %ecx
movzwl (%rsi,%rcx,2), %r11d
movl %r8d, %ecx
andl %r11d, %ecx
movl %ecx, %r11d
shrl $0x3, %r11d
andb $0x7, %cl
movb $0x1, %bl
shlb %cl, %bl
orb %bl, (%rdi,%r11)
incq %r10
jmp 0x5485
movq 0x3b40(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x1bd0(%rip), %rdi      # 0x7092
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x1260
pushq $-0x1
popq %rax
popq %rbx
retq
nop