// File: /workspace/github_cpp_makefile_star2_O1/AndreiBarsan[P]uShell/shell.cc
// Function: microshell::core::handle_sigint(int)
void handle_sigint(int signo) {
  // TODO(andrei) This will be invalid for a brief moment between when this
  // signal handler is set up and when the shell initialization finishes.
  Shell *shell = Shell::get();

  if(SIGINT != signo) {
    // TODO(andrei) Signal2name.
    shell->fatal("Signal mismatch.  Expecting SIGINT, got " + to_string(signo));
  }

  if(shell->get_waiting_for_child()) {
    shell->info("C-c while child was running.");
  }
  else {
    shell->info("C-c while NO child was running. Terminating shell.");
    // TODO(andrei) Ensure that we synchronize properly.
    shell->exit();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edi, %r14d
callq 0x67c2
movq %rax, %rbx
cmpl $0x2, %r14d
jne 0x9a62
cmpb $0x1, 0xe8(%rbx)
jne 0x9a12
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x4943(%rip), %rsi      # 0xe329
leaq 0x4958(%rip), %rdx      # 0xe345
leaq -0x48(%rbp), %rdi
callq 0x713a
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x9c10
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x9a53
callq 0x5230
jmp 0x9a53
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x4925(%rip), %rsi      # 0xe346
leaq 0x4950(%rip), %rdx      # 0xe378
leaq -0x48(%rbp), %rdi
callq 0x713a
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x9c10
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x9a4b
callq 0x5230
movq %rbx, %rdi
callq 0x9d12
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %r15d
negl %r15d
cmovsl %r14d, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x9ac2
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x9ab9
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x9abf
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x9ac2
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x9a86
addl $-0x3, %r12d
jmp 0x9ac2
addl $-0x2, %r12d
jmp 0x9ac2
decl %r12d
shrl $0x1f, %r14d
leal (%r12,%r14), %esi
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x68(%rbp), %r13
movq %r13, %rdi
movl $0x2d, %edx
callq 0x52b0
addq (%r13), %r14
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x6a15
leaq 0x4804(%rip), %rcx      # 0xe300
movl $0x28, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5290
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x9b2e
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x9b39
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
movq 0x8(%rax), %rdx
leaq -0x48(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0x9ba4
jmp 0x9b5e
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
jne 0x9b96
jmp 0x9b9b
jmp 0x9b6e
movq %rax, %rbx
jmp 0x9b9b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x9b89
callq 0x5230
jmp 0x9b89
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x9b9b
callq 0x5230
movq %rbx, %rdi
callq 0x5400
nop