// File: /workspace/github_c_makefile_star2_O3/pocari[P]compilerbook-9cc/parser.c
// Function: assign
static Node *assign() {
  Node *node = ternary();
  Token *tk;

  // chibicc だと "=" 以外の +=, -=... 計の演算子は別途 ND_ADD_EQ のような専用のNode種別をつくって処理している
  // https://github.com/rui314/chibicc/commit/05e907d2b8a94103d60148ce90e27ca191ad5446
  // 難しかったので、簡単そうな i += x を構文木上 i = i + x に読み替える方式にしてみる。
  // ただそのせいで、左辺のnodeが複数のnodeで共有されてしまってfree_nodesのときに複数回freeしてしまってエラーになったので、
  // chibccに合わせて今回からastのfreeはやめる
  if (tk = consume("=")) {
    return new_bin_node(ND_ASSIGN, node, assign(), tk);
  } else if (tk = consume("+=")) {
    Node *n = new_add_node(node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("-=")) {
    Node *n = new_sub_node(node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("*=")) {
    Node *n = new_bin_node(ND_MUL, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("/=")) {
    Node *n = new_bin_node(ND_DIV, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("<<=")) {
    Node *n = new_bin_node(ND_A_LSHIFT, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume(">>=")) {
    Node *n = new_bin_node(ND_A_RSHIFT, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("|=")) {
    Node *n = new_bin_node(ND_BIT_OR, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("&=")) {
    Node *n = new_bin_node(ND_BIT_AND, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  } else if (tk = consume("^=")) {
    Node *n = new_bin_node(ND_BIT_XOR, node, assign(), tk);
    return new_bin_node(ND_ASSIGN, node, n, tk);
  }
  return node;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x5fef
movq %rax, %rbx
leaq 0x4d0a(%rip), %rdi      # 0xc901
callq 0x51eb
testb %al, %al
je 0x7c4e
leaq 0x8879(%rip), %rax      # 0x10480
movq (%rax), %r12
movq 0x8(%r12), %rcx
movq %rcx, (%rax)
callq 0x7be0
movq %rax, %r14
movl $0x1, %edi
movl $0xc8, %esi
callq 0x2100
movq %rax, %r15
movl $0x16, (%rax)
movq %r12, 0x8(%rax)
movq %rbx, 0x18(%rax)
movq %r14, 0x20(%rax)
movq %rax, %rdi
callq 0x9eef
movq %r15, %rbx
jmp 0x7cea
leaq 0x4d62(%rip), %rdi      # 0xc9b7
callq 0x51eb
testb %al, %al
je 0x7c84
leaq 0x881b(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x6651
jmp 0x7cb8
leaq 0x4d2f(%rip), %rdi      # 0xc9ba
callq 0x51eb
testb %al, %al
je 0x7cf9
leaq 0x87e5(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x6727
movq %rax, %r15
movl $0x1, %edi
movl $0xc8, %esi
callq 0x2100
movq %rax, %r12
movl $0x16, (%rax)
movq %r14, 0x8(%rax)
movq %rbx, 0x18(%rax)
movq %r15, 0x20(%rax)
movq %rax, %rdi
callq 0x9eef
movq %r12, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x4cbd(%rip), %rdi      # 0xc9bd
callq 0x51eb
testb %al, %al
je 0x7d3d
leaq 0x8770(%rip), %rax      # 0x10480
movq (%rax), %r12
movq 0x8(%r12), %rcx
movq %rcx, (%rax)
callq 0x7be0
movq %rax, %r14
movl $0x1, %edi
movl $0xc8, %esi
callq 0x2100
movq %rax, %r15
movl $0x6, (%rax)
jmp 0x7d7f
leaq 0x4c7c(%rip), %rdi      # 0xc9c0
callq 0x51eb
testb %al, %al
je 0x7dc7
leaq 0x872c(%rip), %rax      # 0x10480
movq (%rax), %r12
movq 0x8(%r12), %rcx
movq %rcx, (%rax)
callq 0x7be0
movq %rax, %r14
movl $0x1, %edi
movl $0xc8, %esi
callq 0x2100
movq %rax, %r15
movl $0x7, (%rax)
movq %r12, 0x8(%rax)
movq %rbx, 0x18(%rax)
movq %r14, 0x20(%rax)
movq %rax, %rdi
callq 0x9eef
movl $0x1, %edi
movl $0xc8, %esi
callq 0x2100
movq %rax, %r14
movl $0x16, (%rax)
movq %r12, 0x8(%rax)
movq %rbx, 0x18(%rax)
movq %r15, 0x20(%rax)
movq %rax, %rdi
callq 0x9eef
movq %r14, %rbx
jmp 0x7cea
leaq 0x4bf5(%rip), %rdi      # 0xc9c3
callq 0x51eb
testb %al, %al
je 0x7df7
leaq 0x86a2(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movl $0xf, %edi
jmp 0x7eb0
leaq 0x4bc9(%rip), %rdi      # 0xc9c7
callq 0x51eb
testb %al, %al
je 0x7e27
leaq 0x8672(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movl $0x10, %edi
jmp 0x7eb0
leaq 0x4b9d(%rip), %rdi      # 0xc9cb
callq 0x51eb
testb %al, %al
je 0x7e54
leaq 0x8642(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movl $0xd, %edi
jmp 0x7eb0
leaq 0x4b73(%rip), %rdi      # 0xc9ce
callq 0x51eb
testb %al, %al
je 0x7e81
leaq 0x8615(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movl $0xe, %edi
jmp 0x7eb0
leaq 0x4b49(%rip), %rdi      # 0xc9d1
callq 0x51eb
testb %al, %al
je 0x7cea
leaq 0x85e4(%rip), %rax      # 0x10480
movq (%rax), %r14
movq 0x8(%r14), %rcx
movq %rcx, (%rax)
callq 0x7be0
movl $0x11, %edi
movq %rbx, %rsi
movq %rax, %rdx
movq %r14, %rcx
callq 0x60ec
movl $0x16, %edi
movq %rbx, %rsi
movq %rax, %rdx
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x60ec