// File: /workspace/github_c_makefile_star2_O0/ejunjsh[P]mycc/main.c
// Function: do_compile
static char *do_compile(char *filename) {
  char cmd[TEXTLEN];

  // 改变输入文件后缀为.s
  Outfilename = alter_suffix(filename, 's');
  if (Outfilename == NULL) {
    fprintf(stderr, "Error: %s has no suffix, try .c on the end\n", filename);
    exit(1);
  }

  // 生成预处理器命令
  snprintf(cmd, TEXTLEN, "%s %s %s", CPPCMD, INCDIR, filename);

  // 打开预处理器管道
  if ((Infile = popen(cmd, "r")) == NULL) {
    fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno));
    exit(1);
  }
  Infilename = filename;

  // 创建输出文件
  if ((Outfile = fopen(Outfilename, "w")) == NULL) {
    fprintf(stderr, "Unable to create %s: %s\n", Outfilename,
	    strerror(errno));
    exit(1);
  }

  Line = 1;			// 重置扫描器
  Linestart = 1;
  Putback = '\n';
  clear_symtable();		// 清空符号表
  if (O_verbose)
    printf("compiling %s\n", filename);
  scan(&Token);			//从输入中获取第一个token
  Peektoken.token = 0;		// 设置没有向前看token
  genpreamble(filename);	// 输出前置汇编
  global_declarations();	// 解析开始,解析全局声明
  genpostamble();		// 输出后置汇编
  fclose(Outfile);		// 关闭输出文件

  // 如果需要,打印符号表
  if (O_dumpsym) {
    printf("Symbols for %s\n", filename);
    dumpsymtables();
    fprintf(stdout, "\n\n");
  }

  freestaticsyms();		// 清理静态符号表
  return (Outfilename);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x73, %esi
callq 0x7620
movq %rax, 0xa7d4(%rip)      # 0x12528
cmpq $0x0, 0xa7cc(%rip)      # 0x12528
jne 0x7d84
movq 0xa293(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x592d(%rip), %rsi      # 0xd6a0
movb $0x0, %al
callq 0x20e0
movl $0x1, %edi
callq 0x2140
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %r9
movl $0x200, %esi            # imm = 0x200
leaq 0x570d(%rip), %rdx      # 0xd4a8
leaq 0x592a(%rip), %rcx      # 0xd6cc
leaq 0x593b(%rip), %r8       # 0xd6e4
movb $0x0, %al
callq 0x2080
leaq -0x210(%rbp), %rdi
leaq 0x5ded(%rip), %rsi      # 0xdbab
callq 0x2120
movq %rax, 0xa746(%rip)      # 0x12510
cmpq $0x0, %rax
jne 0x7e21
movq 0xa221(%rip), %rax      # 0x11ff8
movq (%rax), %rax
movq %rax, -0x220(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x218(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x2160
movq -0x220(%rbp), %rdi
movq -0x218(%rbp), %rdx
movq %rax, %rcx
leaq 0x58e1(%rip), %rsi      # 0xd6f1
movb $0x0, %al
callq 0x20e0
movl $0x1, %edi
callq 0x2140
movq -0x8(%rbp), %rax
movq %rax, 0xa6f4(%rip)      # 0x12520
movq 0xa6f5(%rip), %rdi      # 0x12528
leaq 0x58ce(%rip), %rsi      # 0xd708
callq 0x2130
movq %rax, 0xa6d2(%rip)      # 0x12518
cmpq $0x0, %rax
jne 0x7ea0
movq 0xa1a5(%rip), %rax      # 0x11ff8
movq (%rax), %rax
movq %rax, -0x230(%rbp)
movq 0xa6c4(%rip), %rax      # 0x12528
movq %rax, -0x228(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x2160
movq -0x230(%rbp), %rdi
movq -0x228(%rbp), %rdx
movq %rax, %rcx
leaq 0x587b(%rip), %rsi      # 0xd70a
movb $0x0, %al
callq 0x20e0
movl $0x1, %edi
callq 0x2140
movl $0x1, 0xa64e(%rip)      # 0x124f8
movl $0x1, 0xa648(%rip)      # 0x124fc
movl $0xa, 0xa642(%rip)      # 0x12500
callq 0xa5d0
cmpl $0x0, 0xa616(%rip)      # 0x124e0
je 0x7ede
movq -0x8(%rbp), %rsi
leaq 0x584c(%rip), %rdi      # 0xd723
movb $0x0, %al
callq 0x2070
leaq 0xa64b(%rip), %rdi      # 0x12530
callq 0x84c0
movl $0x0, 0xa654(%rip)      # 0x12548
movq -0x8(%rbp), %rdi
callq 0x7540
callq 0x4e30
movb $0x0, %al
callq 0x7560
movq 0xa608(%rip), %rdi      # 0x12518
callq 0x2050
cmpl $0x0, 0xa5cc(%rip)      # 0x124e8
je 0x7f4d
movq -0x8(%rbp), %rsi
leaq 0x5808(%rip), %rdi      # 0xd731
movb $0x0, %al
callq 0x2070
callq 0xac20
movq 0xa09c(%rip), %rax      # 0x11fd8
movq (%rax), %rdi
leaq 0x4302(%rip), %rsi      # 0xc248
movb $0x0, %al
callq 0x20e0
callq 0xa710
movq 0xa5cf(%rip), %rax      # 0x12528
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)