user: 请将以下的汇编代码转换成C语言代码：

```asm
<pcapack_sweep>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    0x20(%rsp),%eax
  test   %edi,%edi
  je     L516
  mov    %esi,%r10d
  test   %esi,%esi
  je     L516
  mov    %rdx,%rsi
  mov    %r9d,%edx
  lea    -0x1(%r9),%r9d
  cmp    $0x1,%r9d
  ja     L1187
  lea    -0x1(%rax),%r9d
  cmp    $0x3,%r9d
  ja     L348
  cmp    $0x1,%edx
  jne    L1021
  cmp    %r8d,%edi
  jne    L1021
  cmp    $0x1,%eax
  je     L686
  cmp    $0x2,%eax
  je     L555
  cmp    $0x3,%eax
  je     L873
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  mov    %edi,%eax
  movslq %edi,%r12
  mov    %edi,%ebp
  mov    %rsi,%r8
  shr    %eax
  shl    $0x3,%r12
  and    $0xfffffffe,%ebp
  xor    %r9d,%r9d
  lea    -0x1(%rax),%r11d
  xor    %ebx,%ebx
  add    $0x1,%r11
  shl    $0x4,%r11
  nopl   0x0(%rax,%rax,1)
L35:
  xor    %eax,%eax
  cmp    $0x1,%edi
  je     L534
  nopl   0x0(%rax,%rax,1)
L1058:
  movupd (%r8,%rax,1),%xmm0
  movupd (%rcx,%rax,1),%xmm4
  divpd  %xmm4,%xmm0
  movups %xmm0,(%r8,%rax,1)
  add    $0x10,%rax
  cmp    %r11,%rax
  jne    L1058
  movslq %ebp,%rax
  cmp    %ebp,%edi
  je     L864
L1192:
  lea    (%r9,%rax,1),%edx
  movslq %edx,%rdx
  lea    (%rsi,%rdx,8),%rdx
  movsd  (%rdx),%xmm0
  divsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx)
L864:
  add    $0x1,%ebx
  add    %edi,%r9d
  add    %r12,%r8
  cmp    %ebx,%r10d
  jne    L35
  nopw   0x0(%rax,%rax,1)
L516:
  xor    %eax,%eax
L889:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nop
L1021:
  cmp    $0x2,%edx
  jne    L485
  cmp    %r8d,%r10d
  jne    L485
  cmp    $0x1,%eax
  je     L1153
  cmp    $0x2,%eax
  je     L545
  cmp    $0x3,%eax
  je     L368
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%r10),%eax
  movslq %edi,%r11
  mov    %edi,%r9d
  mov    %rsi,%r8
  lea    0x8(%rcx,%rax,8),%rbx
  mov    %edi,%eax
  shl    $0x3,%r11
  and    $0xfffffffe,%r9d
  shr    %eax
  xor    %edx,%edx
  lea    -0x1(%rax),%r10d
  add    $0x1,%r10
  shl    $0x4,%r10
  nopw   0x0(%rax,%rax,1)
L147:
  movsd  (%rcx),%xmm1
  cmp    $0x1,%edi
  je     L125
  movapd %xmm1,%xmm2
  lea    (%r10,%r8,1),%rbp
  mov    %r8,%rax
  unpcklpd %xmm2,%xmm2
  nopl   0x0(%rax)
L483:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  divpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rax,%rbp
  jne    L483
  mov    %r9d,%eax
  cmp    %edi,%r9d
  je     L592
L752:
  add    %edx,%eax
  cltq
  lea    (%rsi,%rax,8),%rax
  movsd  (%rax),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
L592:
  add    $0x8,%rcx
  add    %edi,%edx
  add    %r11,%r8
  cmp    %rcx,%rbx
  jne    L147
  jmp    L516
  nopl   0x0(%rax)
L485:
  cmp    $0x1,%eax
  je     L377
  cmp    $0x2,%eax
  je     L1206
  cmp    $0x3,%eax
  je     L228
  cmp    $0x1,%edx
  je     L1174
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopl   (%rax)
L972:
  mov    %r11d,%eax
  lea    (%rbx,%rdi,1),%rsi
  cltd
  idiv   %r8d
  nopl   0x0(%rax,%rax,1)
L984:
  movsd  (%rsi),%xmm0
  movslq %edx,%rax
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    (%r10,%rdx,1),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rdi,%rsi
  jne    L984
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L972
  jmp    L516
L555:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  mov    %edi,%eax
  movslq %edi,%r12
  mov    %edi,%ebp
  mov    %rsi,%r8
  shr    %eax
  shl    $0x3,%r12
  and    $0xfffffffe,%ebp
  xor    %r9d,%r9d
  lea    -0x1(%rax),%r11d
  xor    %ebx,%ebx
  add    $0x1,%r11
  shl    $0x4,%r11
L577:
  xor    %eax,%eax
  cmp    $0x1,%edi
  je     L459
  nopl   0x0(%rax,%rax,1)
L802:
  movupd (%r8,%rax,1),%xmm0
  movupd (%rcx,%rax,1),%xmm5
  subpd  %xmm5,%xmm0
  movups %xmm0,(%r8,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%r11
  jne    L802
  movslq %ebp,%rax
  cmp    %ebp,%edi
  je     L278
L987:
  lea    (%r9,%rax,1),%edx
  movslq %edx,%rdx
  lea    (%rsi,%rdx,8),%rdx
  movsd  (%rdx),%xmm0
  subsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx)
L278:
  add    $0x1,%ebx
  add    %edi,%r9d
  add    %r12,%r8
  cmp    %ebx,%r10d
  jne    L577
  jmp    L516
  nop
L686:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  mov    %edi,%eax
  movslq %edi,%r12
  mov    %edi,%ebp
  mov    %rsi,%r8
  shr    %eax
  shl    $0x3,%r12
  and    $0xfffffffe,%ebp
  xor    %r9d,%r9d
  lea    -0x1(%rax),%r11d
  xor    %ebx,%ebx
  add    $0x1,%r11
  shl    $0x4,%r11
  nopl   (%rax)
L544:
  xor    %eax,%eax
  cmp    $0x1,%edi
  je     L777
  nop
L1149:
  movupd (%r8,%rax,1),%xmm3
  movupd (%rcx,%rax,1),%xmm0
  addpd  %xmm3,%xmm0
  movups %xmm0,(%r8,%rax,1)
  add    $0x10,%rax
  cmp    %r11,%rax
  jne    L1149
  movslq %ebp,%rax
  cmp    %ebp,%edi
  je     L211
L660:
  lea    (%r9,%rax,1),%edx
  movslq %edx,%rdx
  lea    (%rsi,%rdx,8),%rdx
  movsd  (%rdx),%xmm0
  addsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx)
L211:
  add    $0x1,%ebx
  add    %edi,%r9d
  add    %r12,%r8
  cmp    %ebx,%r10d
  jne    L544
  jmp    L516
L777:
  xor    %eax,%eax
  jmp    L660
L534:
  xor    %eax,%eax
  jmp    L1192
L1153:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%r10),%eax
  movslq %edi,%r11
  mov    %edi,%r9d
  mov    %rsi,%r8
  lea    0x8(%rcx,%rax,8),%rbx
  mov    %edi,%eax
  shl    $0x3,%r11
  and    $0xfffffffe,%r9d
  shr    %eax
  xor    %edx,%edx
  lea    -0x1(%rax),%r10d
  add    $0x1,%r10
  shl    $0x4,%r10
  nopw   0x0(%rax,%rax,1)
L700:
  movsd  (%rcx),%xmm1
  cmp    $0x1,%edi
  je     L856
  movapd %xmm1,%xmm2
  lea    (%r10,%r8,1),%rbp
  mov    %r8,%rax
  unpcklpd %xmm2,%xmm2
  nopl   0x0(%rax)
L634:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  addpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rax,%rbp
  jne    L634
  mov    %r9d,%eax
  cmp    %r9d,%edi
  je     L466
L1161:
  add    %edx,%eax
  cltq
  lea    (%rsi,%rax,8),%rax
  addsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
L466:
  add    $0x8,%rcx
  add    %edi,%edx
  add    %r11,%r8
  cmp    %rbx,%rcx
  jne    L700
  jmp    L516
L377:
  cmp    $0x1,%edx
  je     L449
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopw   0x0(%rax,%rax,1)
L599:
  mov    %r11d,%eax
  lea    (%rbx,%rdi,1),%rsi
  cltd
  idiv   %r8d
  nopl   0x0(%rax,%rax,1)
L458:
  movsd  (%rsi),%xmm0
  movslq %edx,%rax
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    (%r10,%rdx,1),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rsi,%rdi
  jne    L458
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L599
  jmp    L516
L459:
  xor    %eax,%eax
  jmp    L987
L228:
  cmp    $0x1,%edx
  je     L424
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopl   0x0(%rax)
L271:
  mov    %r11d,%eax
  lea    (%rbx,%rdi,1),%rsi
  cltd
  idiv   %r8d
  nopl   0x0(%rax,%rax,1)
L462:
  movsd  (%rsi),%xmm0
  movslq %edx,%rax
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    (%r10,%rdx,1),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rdi,%rsi
  jne    L462
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L271
  jmp    L516
L368:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%r10),%eax
  movslq %edi,%r11
  mov    %edi,%r9d
  mov    %rsi,%r8
  lea    0x8(%rcx,%rax,8),%rbx
  mov    %edi,%eax
  shl    $0x3,%r11
  and    $0xfffffffe,%r9d
  shr    %eax
  xor    %edx,%edx
  lea    -0x1(%rax),%r10d
  add    $0x1,%r10
  shl    $0x4,%r10
  nopl   0x0(%rax,%rax,1)
L216:
  movsd  (%rcx),%xmm1
  cmp    $0x1,%edi
  je     L1100
  movapd %xmm1,%xmm2
  lea    (%r10,%r8,1),%rbp
  mov    %r8,%rax
  unpcklpd %xmm2,%xmm2
  nopl   0x0(%rax)
L745:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  mulpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rax,%rbp
  jne    L745
  mov    %r9d,%eax
  cmp    %edi,%r9d
  je     L763
L809:
  add    %edx,%eax
  cltq
  lea    (%rsi,%rax,8),%rax
  mulsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
L763:
  add    $0x8,%rcx
  add    %edi,%edx
  add    %r11,%r8
  cmp    %rbx,%rcx
  jne    L216
  jmp    L516
L449:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopl   0x0(%rax)
L929:
  lea    (%rbx,%rdi,1),%rsi
  nopl   0x0(%rax)
L182:
  movslq %edx,%rax
  movsd  (%rsi),%xmm0
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    0x1(%rdx),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rsi,%rdi
  jne    L182
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L929
  jmp    L516
L873:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  mov    %edi,%eax
  movslq %edi,%r12
  mov    %edi,%ebp
  mov    %rsi,%r8
  shr    %eax
  shl    $0x3,%r12
  and    $0xfffffffe,%ebp
  xor    %r9d,%r9d
  lea    -0x1(%rax),%r11d
  xor    %ebx,%ebx
  add    $0x1,%r11
  shl    $0x4,%r11
  nopw   0x0(%rax,%rax,1)
L1163:
  xor    %eax,%eax
  cmp    $0x1,%edi
  je     L367
  nopl   0x0(%rax,%rax,1)
L75:
  movupd (%r8,%rax,1),%xmm6
  movupd (%rcx,%rax,1),%xmm0
  mulpd  %xmm6,%xmm0
  movups %xmm0,(%r8,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%r11
  jne    L75
  movslq %ebp,%rax
  cmp    %ebp,%edi
  je     L590
L890:
  lea    (%r9,%rax,1),%edx
  movslq %edx,%rdx
  lea    (%rsi,%rdx,8),%rdx
  movsd  (%rdx),%xmm0
  mulsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx)
L590:
  add    $0x1,%ebx
  add    %edi,%r9d
  add    %r12,%r8
  cmp    %ebx,%r10d
  jne    L1163
  jmp    L516
L125:
  xor    %eax,%eax
  jmp    L752
L856:
  xor    %eax,%eax
  jmp    L1161
L1206:
  cmp    $0x1,%edx
  je     L135
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopw   0x0(%rax,%rax,1)
L798:
  mov    %r11d,%eax
  lea    (%rbx,%rdi,1),%rsi
  cltd
  idiv   %r8d
  nopl   0x0(%rax,%rax,1)
L796:
  movsd  (%rsi),%xmm0
  movslq %edx,%rax
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    (%r10,%rdx,1),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rsi,%rdi
  jne    L796
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L798
  jmp    L516
L545:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%r10),%eax
  movslq %edi,%r11
  mov    %edi,%r9d
  mov    %rsi,%r8
  lea    0x8(%rcx,%rax,8),%rbx
  mov    %edi,%eax
  shl    $0x3,%r11
  and    $0xfffffffe,%r9d
  shr    %eax
  xor    %edx,%edx
  lea    -0x1(%rax),%r10d
  add    $0x1,%r10
  shl    $0x4,%r10
L696:
  movsd  (%rcx),%xmm1
  cmp    $0x1,%edi
  je     L553
  movapd %xmm1,%xmm2
  lea    (%r10,%r8,1),%rbp
  mov    %r8,%rax
  unpcklpd %xmm2,%xmm2
  nopl   0x0(%rax,%rax,1)
L673:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  subpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rbp,%rax
  jne    L673
  mov    %r9d,%eax
  cmp    %r9d,%edi
  je     L279
L985:
  add    %edx,%eax
  cltq
  lea    (%rsi,%rax,8),%rax
  movsd  (%rax),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
L279:
  add    $0x8,%rcx
  add    %edi,%edx
  add    %r11,%r8
  cmp    %rbx,%rcx
  jne    L696
  jmp    L516
L367:
  xor    %eax,%eax
  jmp    L890
L553:
  xor    %eax,%eax
  jmp    L985
L1100:
  xor    %eax,%eax
  jmp    L809
L1174:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopw   0x0(%rax,%rax,1)
L1210:
  lea    (%rbx,%rdi,1),%rsi
  nopl   0x0(%rax)
L422:
  movslq %edx,%rax
  movsd  (%rsi),%xmm0
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    0x1(%rdx),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rdi,%rsi
  jne    L422
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L1210
  jmp    L516
L135:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
  nopl   0x0(%rax,%rax,1)
L867:
  lea    (%rbx,%rdi,1),%rsi
  nopl   0x0(%rax)
L464:
  movslq %edx,%rax
  movsd  (%rsi),%xmm0
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    0x1(%rdx),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rsi,%rdi
  jne    L464
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L867
  jmp    L516
L1187:
  mov    $0xfffffffa,%eax
  jmp    L889
L424:
  test   %r10d,%r10d
  jle    L516
  test   %edi,%edi
  jle    L516
  lea    -0x1(%rdi),%eax
  movslq %edi,%r9
  mov    $0xfffffffffffffff8,%rbx
  xor    %r11d,%r11d
  shl    $0x3,%rax
  shl    $0x3,%r9
  lea    0x8(%rsi,%rax,1),%rdi
  sub    %rax,%rbx
L11:
  lea    (%rbx,%rdi,1),%rsi
  nopl   0x0(%rax)
L334:
  movslq %edx,%rax
  movsd  (%rsi),%xmm0
  add    $0x8,%rsi
  addsd  (%rcx,%rax,8),%xmm0
  lea    0x1(%rdx),%eax
  cltd
  idiv   %r8d
  movsd  %xmm0,-0x8(%rsi)
  cmp    %rsi,%rdi
  jne    L334
  add    $0x1,%r11d
  add    %r9,%rdi
  cmp    %r11d,%r10d
  jne    L11
  jmp    L516
L348:
  mov    $0xfffffff9,%eax
  jmp    L889
```

assistant: ```c
int pcapack_sweep(const int m, const int n, double *restrict x, double *restrict vec, const int lvec, const int margin, const int fun) {
  int i, j;
  int pos;
  double tmp;
  if (m == 0 || n == 0)
    return 0;
  if (margin != 1 && margin != 2)
    return -6;
  if (fun != 1 && fun != 2 && fun != 3 && fun != 4)
    return -7;
  if (margin == 1 && lvec == m) {
    if (fun == 1) {
      for (j = 0; j < n; j++) {
        for (i = 0; i < m; i++) {
          x[i + m * j] += vec[i];
        }
      };
    } else if (fun == 2) {
      for (j = 0; j < n; j++) {
        for (i = 0; i < m; i++) {
          x[i + m * j] -= vec[i];
        }
      };
    } else if (fun == 3) {
      for (j = 0; j < n; j++) {
        for (i = 0; i < m; i++) {
          x[i + m * j] *= vec[i];
        }
      };
    } else if (fun == 4) {
      for (j = 0; j < n; j++) {
        for (i = 0; i < m; i++) {
          x[i + m * j] /= vec[i];
        }
      };
    }
  } else if (margin == 2 && lvec == n) {
    if (fun == 1) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
      for (j = 0; j < n; j++) {
        tmp = vec[j];
        for (i = 0; i < m; i++) {
          x[i + m * j] += tmp;
        }
      };
    } else if (fun == 2) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
      for (j = 0; j < n; j++) {
        tmp = vec[j];
        for (i = 0; i < m; i++) {
          x[i + m * j] -= tmp;
        }
      };
    } else if (fun == 3) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
      for (j = 0; j < n; j++) {
        tmp = vec[j];
        for (i = 0; i < m; i++) {
          x[i + m * j] *= tmp;
        }
      };
    }
    if (fun == 4) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
      for (j = 0; j < n; j++) {
        tmp = vec[j];
        for (i = 0; i < m; i++) {
          x[i + m * j] /= tmp;
        }
      };
    }
  } else {
    if (fun == 1) {
      if (margin == 1) {
        pos = 1;
        for (j = 0; j < n; j++) {
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + 1) % lvec;
          }
        };
      } else if (margin == 2) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
        for (j = 0; j < n; j++) {
          pos = j % lvec;
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + n) % lvec;
          }
        };
      }
    } else if (fun == 2) {
      if (margin == 1) {
        pos = 1;
        for (j = 0; j < n; j++) {
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + 1) % lvec;
          }
        };
      } else if (margin == 2) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
        for (j = 0; j < n; j++) {
          pos = j % lvec;
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + n) % lvec;
          }
        };
      }
    } else if (fun == 3) {
      if (margin == 1) {
        pos = 1;
        for (j = 0; j < n; j++) {
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + 1) % lvec;
          }
        };
      } else if (margin == 2) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
        for (j = 0; j < n; j++) {
          pos = j % lvec;
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + n) % lvec;
          }
        };
      }
    } else if (fun == 4) {
      if (margin == 1) {
        pos = 1;
        for (j = 0; j < n; j++) {
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + 1) % lvec;
          }
        };
      } else if (margin == 2) {

#pragma omp parallel for default(shared) private(i, j, tmp) if (m * n > OMP_MIN_SIZE)
        for (j = 0; j < n; j++) {
          pos = j % lvec;
          for (i = 0; i < m; i++) {
            x[i + m * j] += vec[pos];
            pos = (pos + n) % lvec;
          }
        };
      }
    }
  }
  return 0;
}
```