// File: /workspace/github_c_makefile_star2_O0/ShinyaKato[P]skcc/file.c
// Function: replace_trigraph
struct utf8c replace_trigraph(struct source *src) {
  unsigned char trigraph_symbol[9] = { '=', '(', '/', ')', '\'', '<', '!', '>', '-' };
  unsigned char trigraph_char[9] = { '#', '[', '\\', ']', '^', '{', '|', '}', '~' };

  for(; src->trigraph_queue_size < 3; src->trigraph_queue_size++) {
    src->trigraph_queue[src->trigraph_queue_size] = fget_utf8c(src);
    if(src->trigraph_queue[src->trigraph_queue_size].bytes == 0) {
      break;
    }
  }

  if(src->trigraph_queue_size == 0) {
    return ueof;
  }

  if(src->trigraph_queue_size == 3) {
    if(src->trigraph_queue[0].sequence[0] == '?') {
      if(src->trigraph_queue[1].sequence[0] == '?') {
        for(int i = 0; i < 9; i++) {
          if(src->trigraph_queue[2].sequence[0] == trigraph_symbol[i]) {
            struct utf8c uc = single_byte_char(trigraph_char[i]);
            src->trigraph_queue_size = 0;
            return uc;
          }
        }
      }
    }
  }

  struct utf8c uc = src->trigraph_queue[0];
  src->trigraph_queue_size--;
  for(int i = 0; i < src->trigraph_queue_size; i++) {
    src->trigraph_queue[i] = src->trigraph_queue[i + 1];
  }
  return uc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x18(%rbp)
movq 0x8424(%rip), %rax      # 0xa09a
movq %rax, -0x21(%rbp)
movb 0x8422(%rip), %al       # 0xa0a2
movb %al, -0x19(%rbp)
movq 0x8419(%rip), %rax      # 0xa0a3
movq %rax, -0x2a(%rbp)
movb 0x8417(%rip), %al       # 0xa0ab
movb %al, -0x22(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x3, 0x18(%rax)
jge 0x1d13
movq -0x18(%rbp), %rdi
movslq 0x18(%rdi), %rax
leaq (%rax,%rax,2), %rax
leaq 0x1c(%rdi,%rax,4), %rax
movq %rax, -0x80(%rbp)
callq 0x1b40
movq %rax, %rcx
movq -0x80(%rbp), %rax
movb %dl, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq %rcx, -0x38(%rbp)
movl -0x40(%rbp), %ecx
movl %ecx, -0x30(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movl -0x30(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
addq $0x1c, %rax
movq -0x18(%rbp), %rcx
movslq 0x18(%rcx), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0x1d02
jmp 0x1d13
jmp 0x1d04
movq -0x18(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
jmp 0x1c97
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x1d36
leaq 0xc364(%rip), %rax      # 0xe088
movq (%rax), %rcx
movq %rcx, -0xc(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e3c
movq -0x18(%rbp), %rax
cmpl $0x3, 0x18(%rax)
jne 0x1dc6
movq -0x18(%rbp), %rax
movzbl 0x20(%rax), %eax
cmpl $0x3f, %eax
jne 0x1dc4
movq -0x18(%rbp), %rax
movzbl 0x2c(%rax), %eax
cmpl $0x3f, %eax
jne 0x1dc2
movl $0x0, -0x4c(%rbp)
cmpl $0x9, -0x4c(%rbp)
jge 0x1dc0
movq -0x18(%rbp), %rax
movzbl 0x38(%rax), %eax
movslq -0x4c(%rbp), %rcx
movzbl -0x21(%rbp,%rcx), %ecx
cmpl %ecx, %eax
jne 0x1db3
movslq -0x4c(%rbp), %rax
movzbl -0x2a(%rbp,%rax), %edi
callq 0x18a0
movb %dl, -0x58(%rbp)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xc(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x4(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
jmp 0x1e3c
jmp 0x1db5
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1d65
jmp 0x1dc2
jmp 0x1dc4
jmp 0x1dc6
movq -0x18(%rbp), %rax
movq 0x1c(%rax), %rcx
movq %rcx, -0xc(%rbp)
movl 0x24(%rax), %eax
movl %eax, -0x4(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rax)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x1e3a
movq -0x18(%rbp), %rax
addq $0x1c, %rax
movslq -0x64(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
addq $0x1c, %rcx
movl -0x64(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x1dec
jmp 0x1e3c
movl -0x4(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0xc(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movb -0x70(%rbp), %dl
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)