// File: /workspace/github_cpp_makefile_star2_O1/andresziemecki[P]MQTT/mqtt.cpp
// Function: main
int main(void){
    
    Broker* broker = Broker::getInstance();

    //ParametrosDelSimClient {Parametro, Subscriptor?, Valor, error, Retener valor, tiempo de ejec}
    usr_pass a_z("\033[1;31mandres\033[0m", "ziemecki");
    ParametrosDelSimClient p1 = {"Presion", false, 1000, 100, true, 15};
    SimPublisher andy(*broker, a_z);
    andy.start(p1);

    this_thread::sleep_for (std::chrono::seconds(2));

    usr_pass h_f("\033[1;36mHoracio\033[0m", "Fontanini");
    ParametrosDelSimClient p3 = {"Temperatura", false, 30, 10, false, 10};
    SimPublisher fonta(*broker, h_f);
    fonta.start(p3);

    usr_pass e_t("\033[1;32mEduardo\033[0m", "Tapia");
    ParametrosDelSimClient p2 = {"Presion", true};
    SimPublisher edu(*broker, e_t);
    edu.start(p2);

    this_thread::sleep_for (std::chrono::seconds(3));

    usr_pass d_b("\033[1;33mDario\033[0m", "Balmaceda");
    ParametrosDelSimClient p4 = {"Temperatura", true};
    SimPublisher dari(*broker, d_b);
    dari.start(p4);

    edu.SubscribeNewTopic("Temperatura");

    this_thread::sleep_for (std::chrono::seconds(5));

    edu.UnsuscribeTopic("Presion");
    edu.UnsuscribeTopic("Presion");
    edu.UnsuscribeTopic("Temperatura");

    this_thread::sleep_for (std::chrono::seconds(2));

    // dari.UnsuscribeTopic("Temperatura");
    edu.Disconnect();
    dari.Disconnect();

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x7f8, %rsp            # imm = 0x7F8
callq 0x3ff2
movq %rax, %rbx
leaq -0x218(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5a4c(%rip), %rsi      # 0x9034
leaq 0x5a56(%rip), %rdx      # 0x9045
leaq -0x228(%rbp), %rdi
callq 0x755a
leaq -0x1f8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x5a39(%rip), %rsi      # 0x9046
leaq 0x5a3a(%rip), %rdx      # 0x904e
leaq -0x208(%rbp), %rdi
callq 0x755a
leaq -0x328(%rbp), %rdi
leaq -0x228(%rbp), %rsi
leaq -0x208(%rbp), %rdx
callq 0x66ee
movq -0x208(%rbp), %rdi
cmpq %r15, %rdi
je 0x364b
callq 0x31c0
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x365c
callq 0x31c0
leaq -0x1d8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x59e1(%rip), %rsi      # 0x904f
leaq 0x59e1(%rip), %rdx      # 0x9056
leaq -0x1e8(%rbp), %rdi
callq 0x755a
movl $0xf, (%rsp)
leaq -0x408(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movl $0x64, %r8d
movl $0x1, %r9d
callq 0x346c
movq -0x1e8(%rbp), %rdi
cmpq %r14, %rdi
je 0x36bf
callq 0x31c0
leaq -0x808(%rbp), %rdi
leaq -0x328(%rbp), %rdx
movq %rbx, %rsi
callq 0x5c56
leaq -0x808(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0x4092
leaq -0x708(%rbp), %r14
movq $0x2, (%r14)
movq $0x0, 0x8(%r14)
movq %r14, %rdi
movq %r14, %rsi
callq 0x30b0
cmpl $-0x1, %eax
jne 0x3718
callq 0x3040
cmpl $0x4, (%rax)
je 0x36fe
leaq -0x1b8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x592d(%rip), %rsi      # 0x9057
leaq 0x5938(%rip), %rdx      # 0x9069
leaq -0x1c8(%rbp), %rdi
callq 0x755a
leaq -0x198(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x591b(%rip), %rsi      # 0x906a
leaq 0x591d(%rip), %rdx      # 0x9073
leaq -0x1a8(%rbp), %rdi
callq 0x755a
leaq -0x2e8(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
callq 0x66ee
movq -0x1a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x378d
callq 0x31c0
movq -0x1c8(%rbp), %rdi
cmpq %r14, %rdi
je 0x379e
callq 0x31c0
leaq -0x178(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x58c4(%rip), %rsi      # 0x9074
leaq 0x58c8(%rip), %rdx      # 0x907f
leaq -0x188(%rbp), %rdi
callq 0x755a
movl $0xa, (%rsp)
leaq -0x3d0(%rbp), %rdi
leaq -0x188(%rbp), %rsi
xorl %edx, %edx
movl $0x1e, %ecx
movl $0xa, %r8d
xorl %r9d, %r9d
callq 0x346c
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x37fe
callq 0x31c0
leaq -0x708(%rbp), %rdi
leaq -0x2e8(%rbp), %rdx
movq %rbx, %rsi
callq 0x5c56
leaq -0x708(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x4092
leaq -0x158(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5847(%rip), %rsi      # 0x9080
leaq 0x5852(%rip), %rdx      # 0x9092
leaq -0x168(%rbp), %rdi
callq 0x755a
leaq -0x138(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x5835(%rip), %rsi      # 0x9093
leaq 0x5833(%rip), %rdx      # 0x9098
leaq -0x148(%rbp), %rdi
callq 0x755a
leaq -0x2a8(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x148(%rbp), %rdx
callq 0x66ee
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x389c
callq 0x31c0
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x38ad
callq 0x31c0
leaq -0x118(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5790(%rip), %rsi      # 0x904f
leaq 0x5790(%rip), %rdx      # 0x9056
leaq -0x128(%rbp), %rdi
callq 0x755a
movl $0xa, (%rsp)
leaq -0x398(%rbp), %rdi
leaq -0x128(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x346c
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x390a
callq 0x31c0
leaq -0x508(%rbp), %rdi
leaq -0x2a8(%rbp), %rdx
movq %rbx, %rsi
callq 0x5c56
leaq -0x508(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x4092
leaq -0x608(%rbp), %r14
movq $0x3, (%r14)
movq $0x0, 0x8(%r14)
movq %r14, %rdi
movq %r14, %rsi
callq 0x30b0
cmpl $-0x1, %eax
jne 0x3963
callq 0x3040
cmpl $0x4, (%rax)
je 0x3949
leaq -0xf8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5724(%rip), %rsi      # 0x9099
leaq 0x572d(%rip), %rdx      # 0x90a9
leaq -0x108(%rbp), %rdi
callq 0x755a
leaq -0xd8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x5710(%rip), %rsi      # 0x90aa
leaq 0x5712(%rip), %rdx      # 0x90b3
leaq -0xe8(%rbp), %rdi
callq 0x755a
leaq -0x268(%rbp), %rdi
leaq -0x108(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x66ee
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0x39d8
callq 0x31c0
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x39e9
callq 0x31c0
leaq -0xb8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5679(%rip), %rsi      # 0x9074
leaq 0x567d(%rip), %rdx      # 0x907f
leaq -0xc8(%rbp), %rdi
callq 0x755a
movl $0xa, (%rsp)
leaq -0x360(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x346c
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3a46
callq 0x31c0
leaq -0x608(%rbp), %rdi
leaq -0x268(%rbp), %rdx
movq %rbx, %rsi
callq 0x5c56
leaq -0x608(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x4092
leaq -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x55f3(%rip), %rsi      # 0x9074
leaq 0x55f7(%rip), %rdx      # 0x907f
leaq -0xa8(%rbp), %rdi
callq 0x755a
leaq -0x508(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4100
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3ab8
callq 0x31c0
leaq -0x28(%rbp), %rbx
movq $0x5, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x30b0
cmpl $-0x1, %eax
jne 0x3ae5
callq 0x3040
cmpl $0x4, (%rax)
je 0x3acb
leaq -0x78(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x555b(%rip), %rsi      # 0x904f
leaq 0x555b(%rip), %rdx      # 0x9056
leaq -0x88(%rbp), %rdi
callq 0x755a
leaq -0x508(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4250
movq -0x88(%rbp), %rdi
cmpq %r14, %rdi
je 0x3b2b
callq 0x31c0
leaq -0x58(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5515(%rip), %rsi      # 0x904f
leaq 0x5515(%rip), %rdx      # 0x9056
leaq -0x68(%rbp), %rdi
callq 0x755a
leaq -0x508(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4250
movq -0x68(%rbp), %rdi
cmpq %r14, %rdi
je 0x3b68
callq 0x31c0
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x54fd(%rip), %rsi      # 0x9074
leaq 0x5501(%rip), %rdx      # 0x907f
leaq -0x48(%rbp), %rdi
callq 0x755a
leaq -0x508(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4250
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x3ba5
callq 0x31c0
leaq -0x28(%rbp), %rbx
movq $0x2, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x30b0
cmpl $-0x1, %eax
jne 0x3bd2
callq 0x3040
cmpl $0x4, (%rax)
je 0x3bb8
movq -0x410(%rbp), %rdi
leaq 0x90a8(%rip), %rbx      # 0xcc88
leaq -0x28(%rbp), %rsi
movq %rbx, (%rsi)
movl $0x5, 0x8(%rsi)
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x510(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movq %rbx, (%rsi)
movl $0x5, 0x8(%rsi)
movq (%rdi), %rax
callq *0x10(%rax)
leaq -0x608(%rbp), %rdi
callq 0x5cea
leaq -0x350(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c30
callq 0x31c0
leaq -0x238(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c45
callq 0x31c0
leaq -0x258(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c5a
callq 0x31c0
leaq -0x508(%rbp), %rdi
callq 0x5cea
leaq -0x388(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c7b
callq 0x31c0
leaq -0x278(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3c90
callq 0x31c0
leaq -0x298(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ca5
callq 0x31c0
leaq -0x708(%rbp), %rdi
callq 0x5cea
leaq -0x3c0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3cc6
callq 0x31c0
leaq -0x2b8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3cdb
callq 0x31c0
leaq -0x2d8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3cf0
callq 0x31c0
leaq -0x808(%rbp), %rdi
callq 0x5cea
leaq -0x3f8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d11
callq 0x31c0
leaq -0x2f8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d26
callq 0x31c0
leaq -0x318(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d3b
callq 0x31c0
xorl %eax, %eax
addq $0x7f8, %rsp            # imm = 0x7F8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x3d82
jmp 0x3f28
movq %rax, %rbx
movq -0x68(%rbp), %rdi
jmp 0x3d82
jmp 0x3f28
movq %rax, %rbx
movq -0x88(%rbp), %rdi
jmp 0x3d82
jmp 0x3f28
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f2b
callq 0x31c0
jmp 0x3f2b
jmp 0x3f28
movq %rax, %rbx
jmp 0x3f37
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x3f47
jmp 0x3f4c
movq %rax, %rbx
jmp 0x3f4c
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3ddb
callq 0x31c0
jmp 0x3ddb
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f5d
callq 0x31c0
jmp 0x3f5d
jmp 0x3f5a
jmp 0x3f5a
movq %rax, %rbx
jmp 0x3f69
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
jne 0x3f79
jmp 0x3f7e
movq %rax, %rbx
jmp 0x3f7e
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x3e40
callq 0x31c0
jmp 0x3e40
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f8a
callq 0x31c0
jmp 0x3f8a
jmp 0x3e5c
movq %rax, %rbx
jmp 0x3f8a
movq %rax, %rbx
jmp 0x3f96
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
jne 0x3fa6
jmp 0x3fab
movq %rax, %rbx
jmp 0x3fab
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r15, %rdi
je 0x3ea5
callq 0x31c0
jmp 0x3ea5
movq %rax, %rbx
movq -0x1c8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3fb7
callq 0x31c0
jmp 0x3fb7
jmp 0x3fec
jmp 0x3fec
movq %rax, %rbx
jmp 0x3fc3
movq %rax, %rbx
movq -0x1e8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x3fd3
jmp 0x3fd8
movq %rax, %rbx
jmp 0x3fd8
movq %rax, %rbx
movq -0x208(%rbp), %rdi
cmpq %r15, %rdi
je 0x3f0a
callq 0x31c0
jmp 0x3f0a
movq %rax, %rbx
movq -0x228(%rbp), %rdi
cmpq %r14, %rdi
je 0x3fe4
callq 0x31c0
jmp 0x3fe4
jmp 0x3f28
jmp 0x3f28
movq %rax, %rbx
leaq -0x608(%rbp), %rdi
callq 0x5cea
leaq -0x350(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f4c
callq 0x31c0
leaq -0x268(%rbp), %rdi
callq 0x6756
jmp 0x3f5d
movq %rax, %rbx
leaq -0x508(%rbp), %rdi
callq 0x5cea
leaq -0x388(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f7e
callq 0x31c0
leaq -0x2a8(%rbp), %rdi
callq 0x6756
leaq -0x708(%rbp), %rdi
callq 0x5cea
leaq -0x3c0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3fab
callq 0x31c0
leaq -0x2e8(%rbp), %rdi
callq 0x6756
leaq -0x808(%rbp), %rdi
callq 0x5cea
leaq -0x3f8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3fd8
callq 0x31c0
leaq -0x328(%rbp), %rdi
callq 0x6756
movq %rbx, %rdi
callq 0x32e0
movq %rax, %rbx
jmp 0x3fb7
nop