user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1d8,%rsp
  lea    D512(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x11c8(%rsp)
  xor    %eax,%eax
  lea    0xdc0(%rsp),%r12
  call   <getenv@plt>
  lea    D832(%rip),%rdi
  mov    %rax,%rbx
  call   <getenv@plt>
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <strlen@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  call   <memcpy@plt>
  lea    D334(%rip),%rdi
  call   <getenv@plt>
  lea    D216(%rip),%rdi
  mov    %rax,0x30(%rsp)
  call   <getenv@plt>
  mov    %rax,0x38(%rsp)
  test   %rbx,%rbx
  je     L482
  test   %rbp,%rbp
  je     L54
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x19c,%eax
  ja     L1
  lea    D349(%rip),%rsi
  mov    %r12,%rdi
  call   <strtok@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L241
  lea    0x3c0(%rsp),%rax
  lea    0x1c0(%rsp),%r12
  mov    %rax,0x8(%rsp)
  lea    0xc0(%rsp),%rax
  lea    0x40(%rsp),%r13
  mov    %rax,0x20(%rsp)
  lea    0x5c0(%rsp),%rax
  lea    0x7c0(%rsp),%rbp
  mov    %rax,0x18(%rsp)
  lea    0xbc0(%rsp),%rax
  lea    0x9c0(%rsp),%r15
  mov    %rax,0x10(%rsp)
  lea    0x140(%rsp),%rax
  mov    %rax,0x28(%rsp)
  nop
L247:
  mov    %r14,%rsi
  lea    D688(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %r12,%rdi
  call   <memset@plt>
  mov    0x8(%rsp),%rdi
  xor    %esi,%esi
  mov    $0x200,%edx
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %rbp,%rdi
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x200,%edx
  mov    %r15,%rdi
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x80,%edx
  mov    %r13,%rdi
  call   <memset@plt>
  mov    0x20(%rsp),%rdi
  xor    %esi,%esi
  mov    $0x80,%edx
  call   <memset@plt>
  mov    0x18(%rsp),%rdi
  xor    %esi,%esi
  mov    $0x200,%edx
  call   <memset@plt>
  mov    0x10(%rsp),%rdi
  xor    %esi,%esi
  mov    $0x200,%edx
  call   <memset@plt>
  mov    0x28(%rsp),%rdi
  mov    $0x80,%edx
  xor    %esi,%esi
  call   <memset@plt>
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  mov    0x8(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strcat@plt>
  mov    0x18(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strcat@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  mov    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  call   <strcat@plt>
  mov    $0x4,%edx
  lea    D700(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L111
  mov    $0x4,%edx
  lea    D633(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L329
  mov    $0x4,%edx
  lea    D278(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L111
  mov    $0x4,%edx
  lea    D822(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L232
  nopw   0x0(%rax,%rax,1)
L329:
  mov    0x30(%rsp),%rdi
  mov    $0x1,%edx
  lea    D469(%rip),%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L230
  mov    0x38(%rsp),%rdi
  mov    $0x3,%edx
  lea    D724(%rip),%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L225
L230:
  lea    D606(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D508(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D535(%rip),%rsi
  mov    %r13,%rdi
L406:
  call   <strcat@plt>
L333:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <bin2h@plt>
L246:
  lea    D349(%rip),%rsi
  xor    %edi,%edi
  call   <strtok@plt>
  mov    %rax,%r14
  test   %rax,%rax
  jne    L247
L241:
  xor    %edi,%edi
  call   <exit@plt>
  xor    %eax,%eax
L465:
  mov    0x11c8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L235
  add    $0x11d8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L111:
  lea    D743(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D736(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D167(%rip),%rsi
  mov    %r13,%rdi
  jmp    L406
L232:
  mov    $0x4,%edx
  lea    D682(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L329
  mov    $0x4,%edx
  lea    D792(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L329
  mov    $0x4,%edx
  lea    D595(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L329
  mov    $0x4,%edx
  lea    D836(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L329
  mov    $0x4,%edx
  lea    D374(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L329
  mov    $0x4,%edx
  lea    D141(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L230
  mov    $0x4,%edx
  lea    D239(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L111
  mov    $0x7,%edx
  lea    D820(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L449
  mov    $0x7,%edx
  lea    D418(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L239
L449:
  lea    D527(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D389(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D513(%rip),%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  mov    0x8(%rsp),%rdi
  lea    D49(%rip),%rsi
  call   <strcat@plt>
  lea    D71(%rip),%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  mov    0x20(%rsp),%rdi
  lea    D583(%rip),%rsi
  call   <strcat@plt>
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <bin2h@plt>
L337:
  mov    0x20(%rsp),%rdx
  mov    0x8(%rsp),%rdi
  mov    %r15,%rsi
  call   <bin2h@plt>
  jmp    L246
L225:
  lea    D680(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D401(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D68(%rip),%rsi
  mov    %r13,%rdi
  jmp    L406
L1:
  lea    D86(%rip),%rdi
  call   <puts@plt>
L184:
  or     $0xffffffff,%eax
  jmp    L465
L54:
  lea    D611(%rip),%rdi
  call   <puts@plt>
  jmp    L184
L482:
  lea    D356(%rip),%rdi
  call   <puts@plt>
  jmp    L184
L239:
  mov    $0x7,%edx
  lea    D608(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L263
  mov    $0x7,%edx
  lea    D330(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L110
L263:
  lea    D361(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D9(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D572(%rip),%rsi
  mov    %r13,%rdi
  jmp    L406
L235:
  call   <__stack_chk_fail@plt>
L110:
  mov    $0x7,%edx
  lea    D470(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L263
  mov    $0x7,%edx
  lea    D184(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L263
  mov    $0x7,%edx
  lea    D523(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L310
  mov    $0x7,%edx
  lea    D104(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L364
L310:
  lea    D361(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  lea    D75(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  lea    D648(%rip),%rsi
  mov    %r13,%rdi
  call   <strcat@plt>
  mov    $0x7,%edx
  lea    D523(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L442
  mov    0x8(%rsp),%rdi
  lea    D719(%rip),%rsi
  call   <strcat@plt>
  lea    D282(%rip),%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  lea    D225(%rip),%rsi
L117:
  mov    0x20(%rsp),%rdi
  jmp    L406
L364:
  mov    $0x7,%edx
  lea    D543(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L104
  mov    $0x7,%edx
  lea    D295(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L445
L104:
  mov    %r12,%rdi
  lea    D63(%rip),%rsi
  call   <strcat@plt>
  mov    %rbp,%rdi
  lea    D845(%rip),%rsi
  call   <strcat@plt>
  mov    %r13,%rdi
  lea    D316(%rip),%rsi
  call   <strcat@plt>
  mov    0x18(%rsp),%rdi
  lea    D302(%rip),%rsi
  call   <strcat@plt>
  mov    0x10(%rsp),%rdi
  lea    D529(%rip),%rsi
  call   <strcat@plt>
  mov    0x28(%rsp),%r14
  lea    D676(%rip),%rsi
  mov    %r14,%rdi
  call   <strcat@plt>
  mov    0x8(%rsp),%rdi
  lea    D174(%rip),%rsi
  call   <strcat@plt>
  mov    %r15,%rdi
  lea    D1(%rip),%rsi
  call   <strcat@plt>
  mov    0x20(%rsp),%rdi
  lea    D683(%rip),%rsi
  call   <strcat@plt>
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <bin2h@plt>
  mov    0x10(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  mov    %r14,%rdx
  call   <bin2h@plt>
  jmp    L337
L442:
  mov    $0x7,%edx
  lea    D104(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L333
  mov    0x8(%rsp),%rdi
  lea    D719(%rip),%rsi
  call   <strcat@plt>
  lea    D697(%rip),%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  lea    D587(%rip),%rsi
  jmp    L117
L445:
  mov    $0x7,%edx
  lea    D46(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L104
  mov    $0x7,%edx
  lea    D644(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L104
  mov    $0x7,%edx
  lea    D221(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L104
  mov    $0x7,%edx
  lea    D226(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L104
  mov    $0x8,%edx
  lea    D628(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L14
L424:
  mov    %r12,%rdi
  lea    D539(%rip),%rsi
  call   <strcat@plt>
  mov    %rbp,%rdi
  lea    D630(%rip),%rsi
  call   <strcat@plt>
  mov    %r13,%rdi
  lea    D187(%rip),%rsi
  call   <strcat@plt>
  mov    0x18(%rsp),%rdi
  lea    D504(%rip),%rsi
  call   <strcat@plt>
  mov    0x10(%rsp),%rdi
  lea    D296(%rip),%rsi
  call   <strcat@plt>
  mov    0x28(%rsp),%r14
  lea    D10(%rip),%rsi
  mov    %r14,%rdi
  call   <strcat@plt>
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <bin2h@plt>
  mov    0x10(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  mov    %r14,%rdx
  call   <bin2h@plt>
  jmp    L246
L14:
  mov    $0x8,%edx
  lea    D171(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L424
  mov    $0x8,%edx
  lea    D449(%rip),%rsi
  mov    %r14,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L424
  mov    %r14,%rsi
  lea    D819(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L246
```

tool_calls: name: extract_symbolic_data
arguments: label: D512
type_infered: string
name: extract_symbolic_data
arguments: label: D832
type_infered: string
name: extract_symbolic_data
arguments: label: D334
type_infered: string
name: extract_symbolic_data
arguments: label: D216
type_infered: string
name: extract_symbolic_data
arguments: label: D349
type_infered: string
name: extract_symbolic_data
arguments: label: D688
type_infered: string
name: extract_symbolic_data
arguments: label: D700
type_infered: string
name: extract_symbolic_data
arguments: label: D633
type_infered: string
name: extract_symbolic_data
arguments: label: D278
type_infered: string
name: extract_symbolic_data
arguments: label: D822
type_infered: string
name: extract_symbolic_data
arguments: label: D469
type_infered: string
name: extract_symbolic_data
arguments: label: D724
type_infered: string
name: extract_symbolic_data
arguments: label: D606
type_infered: string
name: extract_symbolic_data
arguments: label: D508
type_infered: string
name: extract_symbolic_data
arguments: label: D535
type_infered: string
name: extract_symbolic_data
arguments: label: D743
type_infered: string
name: extract_symbolic_data
arguments: label: D736
type_infered: string
name: extract_symbolic_data
arguments: label: D167
type_infered: string
name: extract_symbolic_data
arguments: label: D682
type_infered: string
name: extract_symbolic_data
arguments: label: D792
type_infered: string
name: extract_symbolic_data
arguments: label: D595
type_infered: string
name: extract_symbolic_data
arguments: label: D836
type_infered: string
name: extract_symbolic_data
arguments: label: D374
type_infered: string
name: extract_symbolic_data
arguments: label: D141
type_infered: string
name: extract_symbolic_data
arguments: label: D239
type_infered: string
name: extract_symbolic_data
arguments: label: D820
type_infered: string
name: extract_symbolic_data
arguments: label: D418
type_infered: string
name: extract_symbolic_data
arguments: label: D527
type_infered: string
name: extract_symbolic_data
arguments: label: D389
type_infered: string
name: extract_symbolic_data
arguments: label: D513
type_infered: string
name: extract_symbolic_data
arguments: label: D49
type_infered: string
name: extract_symbolic_data
arguments: label: D71
type_infered: string
name: extract_symbolic_data
arguments: label: D583
type_infered: string
name: extract_symbolic_data
arguments: label: D680
type_infered: string
name: extract_symbolic_data
arguments: label: D401
type_infered: string
name: extract_symbolic_data
arguments: label: D68
type_infered: string
name: extract_symbolic_data
arguments: label: D86
type_infered: string
name: extract_symbolic_data
arguments: label: D611
type_infered: string
name: extract_symbolic_data
arguments: label: D356
type_infered: string
name: extract_symbolic_data
arguments: label: D608
type_infered: string
name: extract_symbolic_data
arguments: label: D330
type_infered: string
name: extract_symbolic_data
arguments: label: D361
type_infered: string
name: extract_symbolic_data
arguments: label: D9
type_infered: string
name: extract_symbolic_data
arguments: label: D572
type_infered: string
name: extract_symbolic_data
arguments: label: D470
type_infered: string
name: extract_symbolic_data
arguments: label: D184
type_infered: string
name: extract_symbolic_data
arguments: label: D523
type_infered: string
name: extract_symbolic_data
arguments: label: D104
type_infered: string
name: extract_symbolic_data
arguments: label: D75
type_infered: string
name: extract_symbolic_data
arguments: label: D648
type_infered: string
name: extract_symbolic_data
arguments: label: D719
type_infered: string
name: extract_symbolic_data
arguments: label: D282
type_infered: string
name: extract_symbolic_data
arguments: label: D225
type_infered: string
name: extract_symbolic_data
arguments: label: D543
type_infered: string
name: extract_symbolic_data
arguments: label: D295
type_infered: string
name: extract_symbolic_data
arguments: label: D63
type_infered: string
name: extract_symbolic_data
arguments: label: D845
type_infered: string
name: extract_symbolic_data
arguments: label: D316
type_infered: string
name: extract_symbolic_data
arguments: label: D302
type_infered: string
name: extract_symbolic_data
arguments: label: D529
type_infered: string
name: extract_symbolic_data
arguments: label: D676
type_infered: string
name: extract_symbolic_data
arguments: label: D174
type_infered: string
name: extract_symbolic_data
arguments: label: D1
type_infered: string
name: extract_symbolic_data
arguments: label: D683
type_infered: string
name: extract_symbolic_data
arguments: label: D697
type_infered: string
name: extract_symbolic_data
arguments: label: D587
type_infered: string
name: extract_symbolic_data
arguments: label: D46
type_infered: string
name: extract_symbolic_data
arguments: label: D644
type_infered: string
name: extract_symbolic_data
arguments: label: D221
type_infered: string
name: extract_symbolic_data
arguments: label: D226
type_infered: string
name: extract_symbolic_data
arguments: label: D628
type_infered: string
name: extract_symbolic_data
arguments: label: D539
type_infered: string
name: extract_symbolic_data
arguments: label: D630
type_infered: string
name: extract_symbolic_data
arguments: label: D187
type_infered: string
name: extract_symbolic_data
arguments: label: D504
type_infered: string
name: extract_symbolic_data
arguments: label: D296
type_infered: string
name: extract_symbolic_data
arguments: label: D10
type_infered: string
name: extract_symbolic_data
arguments: label: D171
type_infered: string
name: extract_symbolic_data
arguments: label: D449
type_infered: string
name: extract_symbolic_data
arguments: label: D819
type_infered: string

tool: D512: RT28xx_DIR

tool: D832: CHIPSET

tool: D334: HAS_WOW_SUPPORT

tool: D216: RT28xx_MODE

tool: D349:  

tool: D688: chipset = %s


tool: D700: 2860

tool: D633: 2870

tool: D278: 3090

tool: D822: 2070

tool: D469: y

tool: D724: STA

tool: D606: /mcu/bin/rt2870.bin

tool: D508: /include/mcu/rt2870_firmware.h

tool: D535: RT2870_FirmwareImage

tool: D743: /mcu/bin/rt2860.bin

tool: D736: /include/mcu/rt2860_firmware.h

tool: D167: RT2860_FirmwareImage

tool: D682: 3070

tool: D792: 3572

tool: D595: 3573

tool: D836: 3370

tool: D374: 5370

tool: D141: 5572

tool: D239: 5592

tool: D820: mt7601e

tool: D418: mt7601u

tool: D527: /mcu/bin/MT7601_formal_1.6.bin

tool: D389: /include/mcu/mt7601_firmware.h

tool: D513: MT7601_FirmwareImage

tool: D49: /eeprom/MT7601_USB_V0_D-20130416.bin

tool: D71: /include/eeprom/mt7601_e2p.h

tool: D583: MT7601_E2PImage

tool: D680: /mcu/bin/rt2870_wow.bin

tool: D401: /include/mcu/rt2870_wow_firmware.h

tool: D68: RT2870_WOW_FirmwareImage

tool: D86: Environment value "RT28xx_DIR" is too long!

tool: D611: Environment value "CHIPSET" not export 

tool: D356: Environment value "RT28xx_DIR" not export 

tool: D608: mt7650e

tool: D330: mt7650u

tool: D361: /mcu/bin/MT7650.bin

tool: D9: /include/mcu/mt7650_firmware.h

tool: D572: MT7650_FirmwareImage

tool: D470: mt7630e

tool: D184: mt7630u

tool: D523: mt7610e

tool: D104: mt7610u

tool: D75: /include/mcu/mt7610_firmware.h

tool: D648: MT7610_FirmwareImage

tool: D719: /eeprom/MT7610U_FEM_V1_1.bin

tool: D282: /include/eeprom/mt7610e_e2p.h

tool: D225: MT7610E_E2PImage

tool: D543: mt7662e

tool: D295: mt7662u

tool: D63: /mcu/bin/MT7662_E3_v1.9.bin

tool: D845: /include/mcu/mt7662_firmware.h

tool: D316: MT7662_FirmwareImage

tool: D302: /mcu/bin/mt7662_patch_e3_hdr_v0.0.2_P69.bin

tool: D529: /include/mcu/mt7662_rom_patch.h

tool: D676: mt7662_rom_patch

tool: D174: /eeprom/MT7612E_EEPROM_layout_20131121_2G5G_ePAeLNA_TXTC_off.bin

tool: D1: /include/eeprom/mt76x2_e2p.h

tool: D683: MT76x2_E2PImage

tool: D697: /include/eeprom/mt7610u_e2p.h

tool: D587: MT7610U_E2PImage

tool: D46: mt7632e

tool: D644: mt7632u

tool: D221: mt7612e

tool: D226: mt7612u

tool: D628: mt7662tu

tool: D539: /mcu/bin/mt7662t_firmware_e1.bin

tool: D630: /include/mcu/mt7662t_firmware.h

tool: D187: MT7662T_FirmwareImage

tool: D504: /mcu/bin/mt7662t_patch_e1_hdr.bin

tool: D296: /include/mcu/mt7662t_rom_patch.h

tool: D10: mt7662t_rom_patch

tool: D171: mt7632tu

tool: D449: mt7612tu

tool: D819: unknown chipset = %s


assistant: ```c
int main(int argc, char *argv[]) {
  char infname[512], ine2pname[512], in_rom_patch[512];
  char outfname[512], oute2pname[512], out_rom_patch[512];
  char chipsets[1024];
  char fw_name[128], e2p_name[128], rom_patch_name[128];
  char *rt28xxdir;
  char *chipset, *token;
  char *wow, *rt28xx_mode;
  int is_bin2h_fw = 0, is_bin2h_rom_patch = 0, is_bin2h_e2p = 0;
  rt28xxdir = (char *)getenv("RT28xx_DIR");
  chipset = (char *)getenv("CHIPSET");
  memcpy(chipsets, chipset, strlen(chipset));
  wow = (char *)getenv("HAS_WOW_SUPPORT");
  rt28xx_mode = (char *)getenv("RT28xx_MODE");
  if (!rt28xxdir) {
    printf("Environment value \"RT28xx_DIR\" not export \n");
    return -1;
  }
  if (!chipset) {
    printf("Environment value \"CHIPSET\" not export \n");
    return -1;
  }
  if (strlen(rt28xxdir) > (sizeof(infname) - 100)) {
    printf("Environment value \"RT28xx_DIR\" is too long!\n");
    return -1;
  }
  chipset = strtok(chipsets, " ");
  while (chipset != NULL) {
    printf("chipset = %s\n", chipset);
    memset(infname, 0, 512);
    memset(ine2pname, 0, 512);
    memset(outfname, 0, 512);
    memset(oute2pname, 0, 512);
    memset(fw_name, 0, 128);
    memset(e2p_name, 0, 128);
    memset(in_rom_patch, 0, 512);
    memset(out_rom_patch, 0, 512);
    memset(rom_patch_name, 0, 128);
    strcat(infname, rt28xxdir);
    strcat(ine2pname, rt28xxdir);
    strcat(in_rom_patch, rt28xxdir);
    strcat(outfname, rt28xxdir);
    strcat(oute2pname, rt28xxdir);
    strcat(out_rom_patch, rt28xxdir);
    is_bin2h_fw = 0;
    is_bin2h_rom_patch = 0;
    is_bin2h_e2p = 0;
    if (strncmp(chipset, "2860", 4) == 0) {
      strcat(infname, "/mcu/bin/rt2860.bin");
      strcat(outfname, "/include/mcu/rt2860_firmware.h");
      strcat(fw_name, "RT2860_FirmwareImage");
      is_bin2h_fw = 1;
    } else if (strncmp(chipset, "2870", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "3090", 4) == 0) {
      strcat(infname, "/mcu/bin/rt2860.bin");
      strcat(outfname, "/include/mcu/rt2860_firmware.h");
      strcat(fw_name, "RT2860_FirmwareImage");
      is_bin2h_fw = 1;
    } else if (strncmp(chipset, "2070", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "3070", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "3572", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "3573", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "3370", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "5370", 4) == 0) {
      if ((strncmp(wow, "y", 1) == 0) && (strncmp(rt28xx_mode, "STA", 3) == 0)) {
        strcat(infname, "/mcu/bin/rt2870_wow.bin");
        strcat(outfname, "/include/mcu/rt2870_wow_firmware.h");
        strcat(fw_name, "RT2870_WOW_FirmwareImage");
        is_bin2h_fw = 1;
      } else {
        strcat(infname, "/mcu/bin/rt2870.bin");
        strcat(outfname, "/include/mcu/rt2870_firmware.h");
        strcat(fw_name, "RT2870_FirmwareImage");
        is_bin2h_fw = 1;
      }
    } else if (strncmp(chipset, "5572", 4) == 0) {
      strcat(infname, "/mcu/bin/rt2870.bin");
      strcat(outfname, "/include/mcu/rt2870_firmware.h");
      strcat(fw_name, "RT2870_FirmwareImage");
      is_bin2h_fw = 1;
    } else if (strncmp(chipset, "5592", 4) == 0) {
      strcat(infname, "/mcu/bin/rt2860.bin");
      strcat(outfname, "/include/mcu/rt2860_firmware.h");
      strcat(fw_name, "RT2860_FirmwareImage");
      is_bin2h_fw = 1;
    } else if ((strncmp(chipset, "mt7601e", 7) == 0) || (strncmp(chipset, "mt7601u", 7) == 0)) {
      strcat(infname, "/mcu/bin/MT7601_formal_1.6.bin");
      strcat(outfname, "/include/mcu/mt7601_firmware.h");
      strcat(fw_name, "MT7601_FirmwareImage");
      is_bin2h_fw = 1;
      strcat(ine2pname, "/eeprom/MT7601_USB_V0_D-20130416.bin");
      strcat(oute2pname, "/include/eeprom/mt7601_e2p.h");
      strcat(e2p_name, "MT7601_E2PImage");
      is_bin2h_e2p = 1;
    } else if ((strncmp(chipset, "mt7650e", 7) == 0) || (strncmp(chipset, "mt7650u", 7) == 0) || (strncmp(chipset, "mt7630e", 7) == 0) || (strncmp(chipset, "mt7630u", 7) == 0)) {
      strcat(infname, "/mcu/bin/MT7650.bin");
      strcat(outfname, "/include/mcu/mt7650_firmware.h");
      strcat(fw_name, "MT7650_FirmwareImage");
      is_bin2h_fw = 1;
    } else if ((strncmp(chipset, "mt7610e", 7) == 0) || (strncmp(chipset, "mt7610u", 7) == 0)) {
      strcat(infname, "/mcu/bin/MT7650.bin");
      strcat(outfname, "/include/mcu/mt7610_firmware.h");
      strcat(fw_name, "MT7610_FirmwareImage");
      is_bin2h_fw = 1;
      if ((strncmp(chipset, "mt7610e", 7) == 0)) {
        strcat(ine2pname, "/eeprom/MT7610U_FEM_V1_1.bin");
        strcat(oute2pname, "/include/eeprom/mt7610e_e2p.h");
        strcat(e2p_name, "MT7610E_E2PImage");
      } else if ((strncmp(chipset, "mt7610u", 7) == 0)) {
        strcat(ine2pname, "/eeprom/MT7610U_FEM_V1_1.bin");
        strcat(oute2pname, "/include/eeprom/mt7610u_e2p.h");
        strcat(e2p_name, "MT7610U_E2PImage");
      }
    } else if ((strncmp(chipset, "mt7662e", 7) == 0) || (strncmp(chipset, "mt7662u", 7) == 0) || (strncmp(chipset, "mt7632e", 7) == 0) || (strncmp(chipset, "mt7632u", 7) == 0) || (strncmp(chipset, "mt7612e", 7) == 0) || (strncmp(chipset, "mt7612u", 7) == 0)) {
      strcat(infname, "/mcu/bin/MT7662_E3_v1.9.bin");
      strcat(outfname, "/include/mcu/mt7662_firmware.h");
      strcat(fw_name, "MT7662_FirmwareImage");
      strcat(in_rom_patch, "/mcu/bin/mt7662_patch_e3_hdr_v0.0.2_P69.bin");
      strcat(out_rom_patch, "/include/mcu/mt7662_rom_patch.h");
      strcat(rom_patch_name, "mt7662_rom_patch");
      strcat(ine2pname, "/eeprom/MT7612E_EEPROM_layout_20131121_2G5G_ePAeLNA_TXTC_off.bin");
      strcat(oute2pname, "/include/eeprom/mt76x2_e2p.h");
      strcat(e2p_name, "MT76x2_E2PImage");
      is_bin2h_fw = 1;
      is_bin2h_rom_patch = 1;
      is_bin2h_e2p = 1;
    } else if ((strncmp(chipset, "mt7662tu", 8) == 0) || (strncmp(chipset, "mt7632tu", 8) == 0) || (strncmp(chipset, "mt7612tu", 8) == 0)) {
      strcat(infname, "/mcu/bin/mt7662t_firmware_e1.bin");
      strcat(outfname, "/include/mcu/mt7662t_firmware.h");
      strcat(fw_name, "MT7662T_FirmwareImage");
      strcat(in_rom_patch, "/mcu/bin/mt7662t_patch_e1_hdr.bin");
      strcat(out_rom_patch, "/include/mcu/mt7662t_rom_patch.h");
      strcat(rom_patch_name, "mt7662t_rom_patch");
      is_bin2h_fw = 1;
      is_bin2h_rom_patch = 1;
    } else {
      printf("unknown chipset = %s\n", chipset);
    }
    if (is_bin2h_fw)
      bin2h(infname, outfname, fw_name);
    if (is_bin2h_rom_patch)
      bin2h(in_rom_patch, out_rom_patch, rom_patch_name);
    if (is_bin2h_e2p)
      bin2h(ine2pname, oute2pname, e2p_name);
    chipset = strtok(NULL, " ");
  }
  exit(0);
}
```