// File: /workspace/github_cpp_makefile_star2_O1/tobias93[P]piano/rtmidi_build/RtMidi.cpp
// Function: MidiInAlsa::initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void MidiInAlsa :: initialize( const std::string& clientName )
{
  // Set up the ALSA sequencer client.
  snd_seq_t *seq;
  int result = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
  if ( result < 0 ) {
    errorString_ = "MidiInAlsa::initialize: error creating ALSA sequencer client object.";
    error( RtMidiError::DRIVER_ERROR, errorString_ );
    return;
  }

  // Set client name.
  snd_seq_set_client_name( seq, clientName.c_str() );

  // Save our api-specific connection information.
  AlsaMidiData *data = (AlsaMidiData *) new AlsaMidiData;
  data->seq = seq;
  data->portNum = -1;
  data->vport = -1;
  data->subscription = 0;
  data->dummy_thread_id = pthread_self();
  data->thread = data->dummy_thread_id;
  data->trigger_fds[0] = -1;
  data->trigger_fds[1] = -1;
  apiData_ = (void *) data;
  inputData_.apiData = (void *) data;

   if ( pipe(data->trigger_fds) == -1 ) {
    errorString_ = "MidiInAlsa::initialize: error creating pipe objects.";
    error( RtMidiError::DRIVER_ERROR, errorString_ );
    return;
  }

  // Create the input queue
#ifndef AVOID_TIMESTAMPING
  data->queue_id = snd_seq_alloc_named_queue(seq, "RtMidi Queue");
  // Set arbitrary tempo (mm=100) and resolution (240)
  snd_seq_queue_tempo_t *qtempo;
  snd_seq_queue_tempo_alloca(&qtempo);
  snd_seq_queue_tempo_set_tempo(qtempo, 600000);
  snd_seq_queue_tempo_set_ppq(qtempo, 240);
  snd_seq_set_queue_tempo(data->seq, data->queue_id, qtempo);
  snd_seq_drain_output(data->seq);
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x473b(%rip), %rsi      # 0xd21d
leaq -0x20(%rbp), %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x7150
testl %eax, %eax
js 0x8bd0
movq -0x20(%rbp), %rdi
movq (%r14), %rsi
callq 0x7450
movl $0x58, %edi
callq 0x7410
movq %rax, %r14
movq -0x20(%rbp), %rax
movq %rax, (%r14)
movq $-0x1, %r15
movq %r15, 0x8(%r14)
movq $0x0, 0x10(%r14)
callq 0x7360
movq %rax, 0x38(%r14)
movq %rax, 0x30(%r14)
leaq 0x4c(%r14), %rdi
movq %r15, 0x4c(%r14)
movq %r14, 0x8(%rbx)
movq %r14, 0x90(%rbx)
callq 0x7620
cmpl $-0x1, %eax
je 0x8c2a
movq -0x20(%rbp), %rdi
leaq 0x4736(%rip), %rsi      # 0xd29f
callq 0x7580
movl %eax, 0x48(%r14)
callq 0x7240
movq %rsp, %rbx
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
callq 0x7240
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x71d0
movq %rbx, %rdi
movl $0x927c0, %esi          # imm = 0x927C0
callq 0x73f0
movq %rbx, %rdi
movl $0xf0, %esi
callq 0x7680
movq (%r14), %rdi
movl 0x48(%r14), %esi
movq %rbx, %rdx
callq 0x7920
movq (%r14), %rdi
callq 0x78c0
jmp 0x8c8a
leaq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rdx
leaq 0x4646(%rip), %rcx      # 0xd225
movl $0x44, %r8d
xorl %esi, %esi
callq 0x7710
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %r14
movq %r14, %rdi
callq 0x7130
movq %rbx, %rdi
movl $0x8, %esi
movq %r14, %rdx
callq 0x7200
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x8c8a
movq -0x50(%rbp), %rsi
jmp 0x8c82
leaq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rdx
leaq 0x4631(%rip), %rcx      # 0xd26a
movl $0x34, %r8d
xorl %esi, %esi
callq 0x7710
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x7130
movq %rbx, %rdi
movl $0x8, %esi
movq %r14, %rdx
callq 0x7200
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x8c8a
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x7420
leaq -0x18(%rbp), %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x40(%rbp), %rdi
jmp 0x8ca5
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x8cb5
movq (%r15), %rsi
incq %rsi
callq 0x7420
movq %rbx, %rdi
callq 0x78b0