// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: MQTTWB(float&)
int MQTTWB(float &f)
{
    //           Test zur Abfrage einer openWB
    if (strcmp(e3dc_config.WB_ip,"0.0.0.0")!=0)
    {
        
        char buf[127];
        static int WP_status = -1;
        int status;
        char path[1024];
        char var [4] [20];
        memset(path, 0x00, sizeof(path));
        f=-1;

        if (WP_status < 2)
        {
            if (e3dc_config.debug) printf("W1");
            mfp = NULL;
            sprintf(buf,"mosquitto_sub -h %s -t %s -W 1 -C 1",e3dc_config.WB_ip,e3dc_config.WB_topic);
            mfp = popen(buf, "r");
            //            int fd = fileno(mfp);
            //            int flags = fcntl(fd, F_GETFL, 0);
            //            flags |= O_NONBLOCK;
            //            fcntl(fd, F_SETFL, flags);
            WP_status = 2;
        }
        if (mfp != NULL)
            while (fgets(path, 1024, mfp) != NULL)
            {
                status = sscanf(path, "%s", var[0]);
                for (int x1=0;x1<status;x1++)
                    f=atof(var[x1]);
            }
        //        if (WP_status < 2)
        if (mfp != NULL)
            pclose(mfp);
        if (e3dc_config.debug) printf("W2");
        WP_status = 0;
        return f;

    }
    return -1;
}

// Assembly:
movabsq $0x302e302e302e30, %rax # imm = 0x302E302E302E30
cmpq %rax, 0x2fd88(%rip)     # 0x369cc
je 0x6ce9
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %rdi, %rbx
leaq 0xd0(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x2150
movl $0xbf800000, (%rbx)     # imm = 0xBF800000
cmpl $0x1, 0x2f6dd(%rip)     # 0x3635c
jg 0x6ced
cmpb $0x1, 0x301bd(%rip)     # 0x36e45
jne 0x6c98
leaq 0x266c1(%rip), %rdi     # 0x2d352
xorl %eax, %eax
callq 0x2040
andq $0x0, 0x32278(%rip)     # 0x38f18
leaq 0x2507f(%rip), %rsi     # 0x2bd26
leaq 0x2fd1e(%rip), %rdx     # 0x369cc
leaq 0x2fd2b(%rip), %rcx     # 0x369e0
leaq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x26b8d(%rip), %rsi     # 0x2d858
movq %r14, %rdi
callq 0x20a0
movq %rax, %rdx
movq %rax, 0x3223b(%rip)     # 0x38f18
movl $0x2, 0x2f675(%rip)     # 0x3635c
jmp 0x6cf4
pushq $-0x1
popq %rax
retq
movq 0x32224(%rip), %rdx     # 0x38f18
testq %rdx, %rdx
je 0x6d6f
leaq 0xd0(%rsp), %r14
xorl %r15d, %r15d
movq %rsp, %r12
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x2470
testq %rax, %rax
je 0x6d5e
movq %r14, %rdi
leaq 0x26836(%rip), %rsi     # 0x2d559
movq %r12, %rdx
xorl %eax, %eax
callq 0x2280
movl %eax, %r13d
testl %eax, %eax
cmovlel %r15d, %r13d
movq %r12, %rbp
subq $0x1, %r13
jb 0x6d55
movq %rbp, %rdi
callq 0x2320
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbx)
addq $0x14, %rbp
jmp 0x6d39
movq 0x321bc(%rip), %rdx     # 0x38f18
jmp 0x6d07
movq 0x321b3(%rip), %rdi     # 0x38f18
testq %rdi, %rdi
je 0x6d6f
callq 0x23e0
cmpb $0x1, 0x300cf(%rip)     # 0x36e45
jne 0x6d86
leaq 0x265d7(%rip), %rdi     # 0x2d356
xorl %eax, %eax
callq 0x2040
andl $0x0, 0x2f5cf(%rip)     # 0x3635c
cvttss2si (%rbx), %eax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq