// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/n2kd/main.c
// Function: closeStream
static void closeStream(int i)
{
  int j;

  close(stream[i].fd);
  FD_CLR(stream[i].fd, &activeSet);
  FD_CLR(stream[i].fd, &readSet);
  FD_CLR(stream[i].fd, &writeSet);
  sbClean(&stream[i].writeBuffer);

  stream[i].fd = INVALID_SOCKET; /* Free for re-use */
  if (i == socketIdxMax)
  {
    socketIdxMax = 0;
    socketFdMax  = 0;
    for (j = i - 1; j >= 0; j--)
    {
      if (stream[j].fd != INVALID_SOCKET)
      {
        socketIdxMax = CB_MAX(socketIdxMax, j);
        socketFdMax  = CB_MAX(socketFdMax, stream[j].fd);
      }
    }
  }
  setHaveNMEA0183Client();
  logDebug("closeStream(%d) (%u..%u fdMax=%d)\n", i, socketIdxMin, socketIdxMax, socketFdMax);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xdb5a(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %edi
callq 0x21b0
movslq -0x4(%rbp), %rcx
leaq 0xdb3e(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, -0x20(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xdb0b(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x20(%rbp), %rdx
movslq %eax, %rcx
leaq 0xd959(%rip), %rax      # 0x11410
andq (%rax,%rcx,8), %rdx
leaq 0xd94e(%rip), %rax      # 0x11410
movq %rdx, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0xdacf(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, -0x18(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xda9c(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x18(%rbp), %rdx
movslq %eax, %rcx
leaq 0xd96a(%rip), %rax      # 0x11490
andq (%rax,%rcx,8), %rdx
leaq 0xd95f(%rip), %rax      # 0x11490
movq %rdx, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0xda60(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
xorq $-0x1, %rax
movq %rax, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xda2d(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x10(%rbp), %rdx
movslq %eax, %rcx
leaq 0xd97b(%rip), %rax      # 0x11510
andq (%rax,%rcx,8), %rdx
leaq 0xd970(%rip), %rax      # 0x11510
movq %rdx, (%rax,%rcx,8)
movslq -0x4(%rbp), %rcx
leaq 0xd9f1(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
cmpq $0x0, 0x8018(%rax)
je 0x3c04
movslq -0x4(%rbp), %rcx
leaq 0xd9d2(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movq 0x8018(%rax), %rdi
callq 0x2030
movslq -0x4(%rbp), %rcx
leaq 0xd9b1(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movq $0x0, 0x8018(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xd991(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movq $0x0, 0x8028(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xd971(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movq $0x0, 0x8020(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xd951(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
cmpl 0xd788(%rip), %eax      # 0x113f0
jne 0x3d33
movl $0x0, 0xd778(%rip)      # 0x113f0
movl $0x0, 0xd772(%rip)      # 0x113f4
movl -0x4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0x3d31
movslq -0x8(%rbp), %rcx
leaq 0xd900(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x3d21
movl 0xd73b(%rip), %eax      # 0x113f0
cmpl -0x8(%rbp), %eax
jle 0x3cc5
movl 0xd730(%rip), %eax      # 0x113f0
movl %eax, -0x24(%rbp)
jmp 0x3ccb
movl -0x8(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, 0xd71c(%rip)      # 0x113f0
movl 0xd71a(%rip), %eax      # 0x113f4
movslq -0x8(%rbp), %rdx
leaq 0xd8bb(%rip), %rcx      # 0x115a0
imulq $0x8038, %rdx, %rdx     # imm = 0x8038
addq %rdx, %rcx
cmpl (%rcx), %eax
jle 0x3cfe
movl 0xd6fb(%rip), %eax      # 0x113f4
movl %eax, -0x28(%rbp)
jmp 0x3d18
movslq -0x8(%rbp), %rcx
leaq 0xd897(%rip), %rax      # 0x115a0
imulq $0x8038, %rcx, %rcx     # imm = 0x8038
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, 0xd6d3(%rip)      # 0x113f4
jmp 0x3d23
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x3c8b
jmp 0x3d33
callq 0x3970
movl -0x4(%rbp), %esi
movl 0xd6ab(%rip), %edx      # 0x113ec
movl 0xd6a9(%rip), %ecx      # 0x113f0
movl 0xd6a6(%rip), %r8d      # 0x113f4
leaq 0x8be6(%rip), %rdi      # 0xc93b
movb $0x0, %al
callq 0x9ae0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)