// File: /workspace/github_cpp_makefile_star2_O3/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 0x67ee
movq %rax, %rbx
cmpl $0x2, %r14d
jne 0x99ce
cmpb $0x1, 0xe8(%rbx)
jne 0x997e
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x49d7(%rip), %rsi      # 0xe329
leaq 0x49ec(%rip), %rdx      # 0xe345
leaq -0x48(%rbp), %rdi
callq 0x7140
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x9b7c
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x99bf
callq 0x5230
jmp 0x99bf
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x49b9(%rip), %rsi      # 0xe346
leaq 0x49e4(%rip), %rdx      # 0xe378
leaq -0x48(%rbp), %rdi
callq 0x7140
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x9b7c
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x99b7
callq 0x5230
movq %rbx, %rdi
callq 0x9c7e
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 0x9a2e
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x9a25
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x9a2b
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x9a2e
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x99f2
addl $-0x3, %r12d
jmp 0x9a2e
addl $-0x2, %r12d
jmp 0x9a2e
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 0x6a3d
leaq 0x4898(%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 0x9a9a
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x9aa5
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 0x9b10
jmp 0x9aca
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
jne 0x9b02
jmp 0x9b07
jmp 0x9ada
movq %rax, %rbx
jmp 0x9b07
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x9af5
callq 0x5230
jmp 0x9af5
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x9b07
callq 0x5230
movq %rbx, %rdi
callq 0x5400
nop