// File: trigrass2[P]giveda_gobject_ansi_cpp/main.cpp
// Function: main
int main(int argc, char** argv)
{
    Sender* s = new Sender;
    s->sendMsg();
    printf("before connect\n");
    
    Receiver *r = new Receiver;
    GObject::connect(s, s->onClick(), r, Receiver::slotOnClick);
    GObject::connect(s, s->notify(), r, Receiver::slotOnNotify);
    printf("after connect\n");
    s->sendMsg();
    
    GObject::disconnect(s, s->onClick(), r, Receiver::slotOnClick);
    GObject::disconnect(s, s->notify(), r, Receiver::slotOnNotify);
    printf("after disconnect\n");
    s->sendMsg();
    
    GObject::connect(s, s->onClick(), r, Receiver::slotOnClick);
    GObject::connect(s, s->notify(), r, Receiver::slotOnNotify);
    delete r;
    printf("connect again, and delete receiver\n");
    s->sendMsg();
    
    delete s;
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x40, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
callq 0x6070
jmp 0x5e74
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x60c0
leaq 0x1210(%rip), %rdi      # 0x709c
xorl %eax, %eax
callq 0x2030
movl $0x10, %edi
callq 0x2130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
callq 0x61b0
jmp 0x5eae
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6230
movq -0x78(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
leaq 0x377(%rip), %rcx       # 0x6250
callq 0x61f0
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
callq 0x62c0
movq -0x70(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
leaq 0x3df(%rip), %rcx       # 0x62e0
callq 0x6280
leaq 0x119f(%rip), %rdi      # 0x70ac
movb $0x0, %al
callq 0x2030
movq -0x18(%rbp), %rdi
callq 0x60c0
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6230
movq -0x68(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
leaq 0x310(%rip), %rcx       # 0x6250
callq 0x6310
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x62c0
movq -0x60(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
leaq 0x378(%rip), %rcx       # 0x62e0
callq 0x6350
leaq 0x1147(%rip), %rdi      # 0x70bb
movb $0x0, %al
callq 0x2030
movq -0x18(%rbp), %rdi
callq 0x60c0
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6230
movq -0x58(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
leaq 0x2a9(%rip), %rcx       # 0x6250
callq 0x61f0
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x62c0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
leaq 0x311(%rip), %rcx       # 0x62e0
callq 0x6280
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x5fec
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x10da(%rip), %rdi      # 0x70cd
movb $0x0, %al
callq 0x2030
movq -0x18(%rbp), %rdi
callq 0x60c0
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x601b
movq -0x80(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
xorl %eax, %eax
addq $0x80, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x40, %esi
callq 0x2140
jmp 0x605c
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x10, %esi
callq 0x2140
movq -0x20(%rbp), %rdi
callq 0x21d0
nopw %cs:(%rax,%rax)
nop