// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x7f8, %rsp            # imm = 0x7F8
callq 0x3ce2
movq %rax, %rbx
leaq 0x4a92(%rip), %rsi      # 0x8034
leaq -0x210(%rbp), %rdi
leaq -0x7f0(%rbp), %rdx
callq 0x30c0
leaq 0x4a8a(%rip), %rsi      # 0x8046
leaq -0x1f0(%rbp), %rdi
leaq -0x6f0(%rbp), %rdx
callq 0x30c0
leaq -0x3f0(%rbp), %rdi
leaq -0x210(%rbp), %rsi
leaq -0x1f0(%rbp), %rdx
callq 0x5714
leaq -0x1f0(%rbp), %rdi
callq 0x30f0
leaq -0x210(%rbp), %rdi
callq 0x30f0
leaq 0x4a47(%rip), %rsi      # 0x804f
leaq -0x1d0(%rbp), %rdi
leaq -0x7f0(%rbp), %rdx
callq 0x30c0
movl $0xf, (%rsp)
leaq -0x2f0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
pushq $0x64
popq %r8
pushq $0x1
popq %r9
xorl %edx, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0x344c
leaq -0x1d0(%rbp), %rdi
callq 0x30f0
leaq -0x7f0(%rbp), %rdi
leaq -0x3f0(%rbp), %rdx
movq %rbx, %rsi
callq 0x5044
leaq -0x7f0(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x3d1a
leaq -0x6f0(%rbp), %rdi
movq $0x2, (%rdi)
callq 0x574a
leaq 0x49c4(%rip), %rsi      # 0x8057
leaq -0x1b0(%rbp), %rdi
leaq -0x6f0(%rbp), %rdx
callq 0x30c0
leaq 0x49bd(%rip), %rsi      # 0x806a
leaq -0x190(%rbp), %rdi
leaq -0x4f0(%rbp), %rdx
callq 0x30c0
leaq -0x3b0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0x5714
leaq -0x190(%rbp), %rdi
callq 0x30f0
leaq -0x1b0(%rbp), %rdi
callq 0x30f0
leaq 0x497b(%rip), %rsi      # 0x8074
leaq -0x170(%rbp), %rdi
leaq -0x6f0(%rbp), %rdx
callq 0x30c0
movl $0xa, (%rsp)
leaq -0x2b8(%rbp), %rdi
leaq -0x170(%rbp), %rsi
pushq $0x1e
popq %rcx
pushq $0xa
popq %r8
xorl %edx, %edx
xorl %r9d, %r9d
callq 0x344c
leaq -0x170(%rbp), %rdi
callq 0x30f0
leaq -0x6f0(%rbp), %rdi
leaq -0x3b0(%rbp), %rdx
movq %rbx, %rsi
callq 0x5044
leaq -0x6f0(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x3d1a
leaq 0x4912(%rip), %rsi      # 0x8080
leaq -0x150(%rbp), %rdi
leaq -0x4f0(%rbp), %rdx
callq 0x30c0
leaq 0x490b(%rip), %rsi      # 0x8093
leaq -0x130(%rbp), %rdi
leaq -0x5f0(%rbp), %rdx
callq 0x30c0
leaq -0x370(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x130(%rbp), %rdx
callq 0x5714
leaq -0x130(%rbp), %rdi
callq 0x30f0
leaq -0x150(%rbp), %rdi
callq 0x30f0
leaq 0x487b(%rip), %rsi      # 0x804f
leaq -0x110(%rbp), %rdi
leaq -0x4f0(%rbp), %rdx
callq 0x30c0
movl $0xa, (%rsp)
leaq -0x280(%rbp), %rdi
leaq -0x110(%rbp), %rsi
pushq $0x1
popq %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x344c
leaq -0x110(%rbp), %rdi
callq 0x30f0
leaq -0x4f0(%rbp), %rdi
leaq -0x370(%rbp), %rdx
movq %rbx, %rsi
callq 0x5044
leaq -0x4f0(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x3d1a
leaq -0x5f0(%rbp), %rdi
movq $0x3, (%rdi)
callq 0x574a
leaq 0x483e(%rip), %rsi      # 0x8099
leaq -0xf0(%rbp), %rdi
leaq -0x5f0(%rbp), %rdx
callq 0x30c0
leaq 0x4835(%rip), %rsi      # 0x80aa
leaq -0xd0(%rbp), %rdi
leaq -0x248(%rbp), %rdx
callq 0x30c0
leaq -0x330(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x5714
leaq -0xd0(%rbp), %rdi
callq 0x30f0
leaq -0xf0(%rbp), %rdi
callq 0x30f0
leaq 0x47b3(%rip), %rsi      # 0x8074
leaq -0xb0(%rbp), %rdi
leaq -0x5f0(%rbp), %rdx
callq 0x30c0
movl $0xa, (%rsp)
leaq -0x248(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
pushq $0x1
popq %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x344c
leaq -0xb0(%rbp), %rdi
callq 0x30f0
leaq -0x5f0(%rbp), %rdi
leaq -0x330(%rbp), %rdx
movq %rbx, %rsi
callq 0x5044
leaq -0x5f0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x3d1a
leaq 0x473f(%rip), %rsi      # 0x8074
leaq -0x90(%rbp), %rdi
leaq -0x10(%rbp), %rdx
callq 0x30c0
leaq -0x4f0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3d74
leaq -0x90(%rbp), %rdi
callq 0x30f0
leaq -0x10(%rbp), %rdi
movq $0x5, (%rdi)
callq 0x574a
leaq 0x46d4(%rip), %rsi      # 0x804f
leaq -0x70(%rbp), %rdi
leaq -0x10(%rbp), %rdx
callq 0x30c0
leaq -0x4f0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3e28
leaq -0x70(%rbp), %rdi
callq 0x30f0
leaq 0x46a7(%rip), %rsi      # 0x804f
leaq -0x50(%rbp), %rdi
leaq -0x10(%rbp), %rdx
callq 0x30c0
leaq -0x4f0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3e28
leaq -0x50(%rbp), %rdi
callq 0x30f0
leaq 0x469f(%rip), %rsi      # 0x8074
leaq -0x30(%rbp), %rdi
leaq -0x10(%rbp), %rdx
callq 0x30c0
leaq -0x4f0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3e28
leaq -0x30(%rbp), %rdi
callq 0x30f0
leaq -0x10(%rbp), %rdi
movq $0x2, (%rdi)
callq 0x574a
leaq -0x4f0(%rbp), %rdi
callq 0x3e9c
leaq -0x5f0(%rbp), %rdi
callq 0x3e9c
leaq -0x5f0(%rbp), %rdi
callq 0x50c4
leaq -0x248(%rbp), %rdi
callq 0x30f0
leaq -0x330(%rbp), %rdi
callq 0x5788
leaq -0x4f0(%rbp), %rdi
callq 0x50c4
leaq -0x280(%rbp), %rdi
callq 0x30f0
leaq -0x370(%rbp), %rdi
callq 0x5788
leaq -0x6f0(%rbp), %rdi
callq 0x50c4
leaq -0x2b8(%rbp), %rdi
callq 0x30f0
leaq -0x3b0(%rbp), %rdi
callq 0x5788
leaq -0x7f0(%rbp), %rdi
callq 0x50c4
leaq -0x2f0(%rbp), %rdi
callq 0x30f0
leaq -0x3f0(%rbp), %rdi
callq 0x5788
xorl %eax, %eax
addq $0x7f8, %rsp            # imm = 0x7F8
popq %rbx
popq %rbp
retq
jmp 0x3c46
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
jmp 0x3afd
jmp 0x3c46
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x3afd
jmp 0x3c46
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0x3afd
jmp 0x3c46
jmp 0x3c46
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x30f0
jmp 0x3c49
jmp 0x3c46
movq %rax, %rbx
jmp 0x3c55
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
jmp 0x3c5c
movq %rax, %rbx
jmp 0x3c61
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x30f0
jmp 0x3b3f
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x30f0
jmp 0x3c6d
jmp 0x3b54
jmp 0x3b54
movq %rax, %rbx
jmp 0x3c6d
movq %rax, %rbx
jmp 0x3c79
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0x3c80
movq %rax, %rbx
jmp 0x3c85
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x30f0
jmp 0x3b8f
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x30f0
jmp 0x3c91
jmp 0x3ba2
movq %rax, %rbx
jmp 0x3c91
movq %rax, %rbx
jmp 0x3c9d
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
jmp 0x3ca4
movq %rax, %rbx
jmp 0x3ca9
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x30f0
jmp 0x3bdd
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x30f0
jmp 0x3cb5
jmp 0x3bf2
jmp 0x3bf2
movq %rax, %rbx
jmp 0x3cb5
movq %rax, %rbx
jmp 0x3cc1
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
jmp 0x3cc8
movq %rax, %rbx
jmp 0x3ccd
movq %rax, %rbx
leaq -0x1f0(%rbp), %rdi
callq 0x30f0
jmp 0x3c2d
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x30f0
jmp 0x3cd9
movq %rax, %rbx
jmp 0x3cd9
movq %rax, %rbx
leaq -0x5f0(%rbp), %rdi
callq 0x50c4
leaq -0x248(%rbp), %rdi
callq 0x30f0
leaq -0x330(%rbp), %rdi
callq 0x5788
leaq -0x4f0(%rbp), %rdi
callq 0x50c4
leaq -0x280(%rbp), %rdi
callq 0x30f0
leaq -0x370(%rbp), %rdi
callq 0x5788
leaq -0x6f0(%rbp), %rdi
callq 0x50c4
leaq -0x2b8(%rbp), %rdi
callq 0x30f0
leaq -0x3b0(%rbp), %rdi
callq 0x5788
leaq -0x7f0(%rbp), %rdi
callq 0x50c4
leaq -0x2f0(%rbp), %rdi
callq 0x30f0
leaq -0x3f0(%rbp), %rdi
callq 0x5788
movq %rbx, %rdi
callq 0x32f0
nop