// File: tobias93[P]piano/rtmidi_build/RtMidi.cpp
// Function: MidiOutAlsa::initialize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void MidiOutAlsa :: initialize( const std::string& clientName )
{
  // Set up the ALSA sequencer client.
  snd_seq_t *seq;
  int result1 = snd_seq_open( &seq, "default", SND_SEQ_OPEN_OUTPUT, SND_SEQ_NONBLOCK );
  if ( result1 < 0 ) {
    errorString_ = "MidiOutAlsa::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->bufferSize = 32;
  data->coder = 0;
  data->buffer = 0;
  int result = snd_midi_event_new( data->bufferSize, &data->coder );
  if ( result < 0 ) {
    delete data;
    errorString_ = "MidiOutAlsa::initialize: error initializing MIDI event parser!\n\n";
    error( RtMidiError::DRIVER_ERROR, errorString_ );
    return;
  }
  data->buffer = (unsigned char *) malloc( data->bufferSize );
  if ( data->buffer == NULL ) {
    delete data;
    errorString_ = "MidiOutAlsa::initialize: error allocating buffer memory!\n\n";
    error( RtMidiError::MEMORY_ERROR, errorString_ );
    return;
  }
  snd_midi_event_init( data->coder );
  apiData_ = (void *) data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x18(%rbp), %rdi
leaq 0x781c(%rip), %rsi      # 0x19225
movl $0x1, %ecx
movl %ecx, %edx
callq 0xd3c0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x11a95
movq -0xa8(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0xb8(%rbp)
leaq 0x7a88(%rip), %rsi      # 0x194bf
callq 0xdfb0
movq -0xb8(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0xd3d0
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
movl $0x8, %esi
callq 0xd5f0
jmp 0x11a6d
leaq -0x40(%rbp), %rdi
callq 0xd600
jmp 0x11ca6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xd600
jmp 0x11caf
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rdi
callq 0xd3b0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0xdbb0
movl $0x58, %edi
callq 0xda40
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x58(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movq -0x58(%rbp), %rax
movl $0x20, 0x20(%rax)
movq -0x58(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x58(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x58(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %edi
movq -0x58(%rbp), %rsi
addq $0x18, %rsi
callq 0xe050
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jge 0x11bc6
movq -0x58(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0x11b4f
movq -0xc8(%rbp), %rdi
movl $0x58, %esi
callq 0xda90
movq -0xa8(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0xd8(%rbp)
leaq 0x799d(%rip), %rsi      # 0x19505
callq 0xdfb0
movq -0xd8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0xd3d0
movq -0xa8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
movl $0x8, %esi
callq 0xd5f0
jmp 0x11b9e
leaq -0x80(%rbp), %rdi
callq 0xd600
jmp 0x11ca6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xd600
jmp 0x11caf
movq -0x58(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %edi
callq 0xdf10
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x11c8a
movq -0x58(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, %rax
je 0x11c10
movq -0xe0(%rbp), %rdi
movl $0x58, %esi
callq 0xda90
movq -0xa8(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0xf0(%rbp)
leaq 0x791d(%rip), %rsi      # 0x19546
callq 0xdfb0
movq -0xf0(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xd3d0
movq -0xa8(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movl $0x5, %esi
callq 0xd5f0
jmp 0x11c62
leaq -0xa0(%rbp), %rdi
callq 0xd600
jmp 0x11ca6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xd600
jmp 0x11caf
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd470
movq -0xa8(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x8(%rax)
addq $0xf0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0xe590
nopl (%rax,%rax)