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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x20000(%rsp),%r11
L145:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L145
  sub    $0x438,%rsp
  mov    %fs:0x28,%rdx
  mov    %rdx,0x20428(%rsp)
  xor    %edx,%edx
  cmp    $0x1,%edi
  jle    L20
  cmp    $0x2,%edi
  je     L89
  lea    D25(%rip),%rdi
  call   <printf@plt>
L120:
  mov    0x20428(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L139
  add    $0x20438,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L89:
  mov    0x8(%rsi),%rdi
  mov    %rsi,%rbp
  lea    D54(%rip),%rsi
  lea    0x420(%rsp),%rbx
  call   <fopen@plt>
  mov    $0x10000,%edx
  mov    $0x1,%esi
  mov    %rbx,%rdi
  mov    %rax,%rcx
  mov    %rax,%r12
  call   <fread@plt>
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x8(%rbp),%rdi
  lea    D44(%rip),%rsi
  call   <strtok@plt>
  lea    D111(%rip),%rdi
  mov    %rax,(%rsp)
  call   <printf@plt>
  lea    0x1c(%rsp),%rsi
  lea    D163(%rip),%rdi
  call   <scanf@plt>
  mov    0x1c(%rsp),%esi
  mov    0x20(%rsp),%edx
  xor    %r8d,%r8d
  mov    0x41c(%rsp),%ecx
  xor    %edi,%edi
  xor    %eax,%eax
  jmp    L62
  nopw   0x0(%rax,%rax,1)
L156:
  add    $0x1,%eax
  add    $0x1,%edx
  mov    $0x1,%edi
  cmp    $0x100,%eax
  je     L38
L62:
  cmp    %eax,%esi
  jg     L156
  add    $0x1,%eax
  add    $0x1,%ecx
  mov    $0x1,%r8d
  cmp    $0x100,%eax
  jne    L62
L38:
  test   %r8b,%r8b
  je     L203
  mov    %ecx,0x41c(%rsp)
L203:
  test   %dil,%dil
  je     L27
  mov    %edx,0x20(%rsp)
L27:
  lea    0x10420(%rsp),%rcx
  movd   %esi,%xmm6
  mov    %rbx,%rdx
  movdqa D91(%rip),%xmm5
  mov    %rcx,0x8(%rsp)
  pshufd $0x0,%xmm6,%xmm3
  mov    %rcx,%rdi
  pxor   %xmm6,%xmm6
  movdqa D117(%rip),%xmm7
  pxor   %xmm4,%xmm4
L26:
  xor    %eax,%eax
  nopl   0x0(%rax)
L144:
  movdqa (%rdx,%rax,1),%xmm2
  movdqa %xmm2,%xmm8
  punpckhbw %xmm6,%xmm2
  punpcklbw %xmm6,%xmm8
  movdqa %xmm2,%xmm0
  punpckhwd %xmm4,%xmm2
  movdqa %xmm8,%xmm1
  punpckhwd %xmm4,%xmm8
  punpcklwd %xmm4,%xmm0
  pcmpgtd %xmm3,%xmm8
  pcmpgtd %xmm3,%xmm0
  punpcklwd %xmm4,%xmm1
  pcmpgtd %xmm3,%xmm1
  pcmpgtd %xmm3,%xmm2
  pand   %xmm5,%xmm8
  pand   %xmm5,%xmm0
  pand   %xmm5,%xmm1
  pand   %xmm5,%xmm2
  movdqa %xmm1,%xmm9
  punpcklwd %xmm8,%xmm1
  punpckhwd %xmm8,%xmm9
  movdqa %xmm1,%xmm8
  punpckhwd %xmm9,%xmm8
  punpcklwd %xmm9,%xmm1
  punpcklwd %xmm8,%xmm1
  movdqa %xmm0,%xmm8
  punpcklwd %xmm2,%xmm0
  punpckhwd %xmm2,%xmm8
  movdqa %xmm0,%xmm2
  pand   %xmm7,%xmm1
  punpckhwd %xmm8,%xmm2
  punpcklwd %xmm8,%xmm0
  punpcklwd %xmm2,%xmm0
  pand   %xmm7,%xmm0
  packuswb %xmm0,%xmm1
  movdqa %xmm6,%xmm0
  psubb  %xmm1,%xmm0
  movaps %xmm0,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    $0x100,%rax
  jne    L144
  add    $0x100,%rdx
  add    $0x100,%rcx
  cmp    %rdx,%rdi
  jne    L26
  mov    (%rsp),%rdi
  lea    D165(%rip),%r15
  lea    D93(%rip),%r14
  mov    %r15,%rsi
  call   <strcmp@plt>
  mov    %r14,%rsi
  test   %rax,%rax
  jne    L169
  lea    D58(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
L115:
  xor    %ebx,%ebx
  lea    0x20(%rsp),%rbp
  lea    D88(%rip),%r13
L54:
  mov    0x0(%rbp,%rbx,4),%ecx
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  add    $0x1,%rbx
  call   <fprintf@plt>
  cmp    $0x100,%rbx
  jne    L54
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    (%rsp),%rdi
  mov    %r15,%rsi
  call   <strcmp@plt>
  mov    %r14,%rsi
  test   %rax,%rax
  jne    L163
  lea    D125(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
L19:
  mov    0x8(%rsp),%rdi
  mov    $0x1,%esi
  mov    %r13,%rcx
  mov    $0x10000,%edx
  call   <fwrite@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    (%rsp),%rdi
  mov    %r15,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L113
  lea    D99(%rip),%rdi
  call   <system@plt>
  jmp    L120
L169:
  lea    D102(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  jmp    L115
L113:
  lea    D71(%rip),%rdi
  call   <system@plt>
  jmp    L120
L163:
  lea    D13(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  jmp    L19
L20:
  lea    D86(%rip),%rdi
  call   <printf@plt>
  jmp    L120
L139:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D25
type_guessed: string
name: parse_data
arguments: label: D54
type_guessed: string
name: parse_data
arguments: label: D44
type_guessed: string
name: parse_data
arguments: label: D111
type_guessed: string
name: parse_data
arguments: label: D163
type_guessed: string
name: parse_data
arguments: label: D91
type_guessed: byte[16]
name: parse_data
arguments: label: D117
type_guessed: byte[16]
name: parse_data
arguments: label: D165
type_guessed: string
name: parse_data
arguments: label: D93
type_guessed: string
name: parse_data
arguments: label: D58
type_guessed: string
name: parse_data
arguments: label: D88
type_guessed: string
name: parse_data
arguments: label: D125
type_guessed: string
name: parse_data
arguments: label: D99
type_guessed: string
name: parse_data
arguments: label: D102
type_guessed: string
name: parse_data
arguments: label: D71
type_guessed: string
name: parse_data
arguments: label: D13
type_guessed: string
name: parse_data
arguments: label: D86
type_guessed: string

tool: D25: many arguments


tool: D54: rb

tool: D44: .

tool: D111: input theta value


tool: D163: %d

tool: {"D91": [0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

tool: {"D117": [0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00]}

tool: D165: girl

tool: D93: wb

tool: D58: plot_ex1girl.dat

tool: D88: %3d %3d


tool: D125: girlex1_binary.dat

tool: D99: zsh mode_girl.sh

tool: D102: plot_ex1ei.dat

tool: D71: zsh mode_ei.sh

tool: D13: eiex1_binary.dat

tool: D86: don't read filename


assistant: ```c
int main(int argc, char *argv[]) {
  unsigned char image[256][256];
  unsigned char image_w[256][256];
  int histgram[256] = {0};
  int mode;
  char *fn;
  FILE *fp;
  if (argc < 2) {
    printf("don't read filename\n");
    return 0;
  } else if (argc > 2) {
    printf("many arguments\n");
    return 0;
  } else {
    fp = fopen(argv[1], "rb");
    fread(image, sizeof(unsigned char), 256 * 256, fp);
    fclose(fp);
    fn = strtok(argv[1], ".");
    printf("input theta value\n");
    scanf("%d", &mode);
    int newhist[256];
    for (int i = 0; i < 256; i++) {
      if (i < mode) {
        newhist[0]++;
      } else {
        newhist[255]++;
      }
    }
    for (int i = 0; i < 256; i++) {
      for (int j = 0; j < 256; j++) {
        if (image[i][j] > mode) {
          image_w[i][j] = 255;
        } else {
          image_w[i][j] = 0;
        }
      }
    }
    if (strcmp(fn, "girl") == 0) {
      fp = fopen("plot_ex1girl.dat", "wb");
    } else {
      fp = fopen("plot_ex1ei.dat", "wb");
    }
    for (int i = 0; i < 256; i++) {
      fprintf(fp, "%3d %3d\n", i, newhist[i]);
    }
    fclose(fp);
    if (strcmp(fn, "girl") == 0) {
      fp = fopen("girlex1_binary.dat", "wb");
    } else {
      fp = fopen("eiex1_binary.dat", "wb");
    }
    fwrite(image_w, sizeof(unsigned char), 256 * 256, fp);
    fclose(fp);
    if (strcmp(fn, "girl") == 0) {
      system("zsh mode_girl.sh");
    } else {
      system("zsh mode_ei.sh");
    }
    return 0;
  }
}
```