// File: Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: MQTTE3DC(float*)
int MQTTE3DC(float f[3])
{
    //           Test zur Abfrage eines zweiten E3DC
    if (strcmp(e3dc_config.mqtt3_ip,"0.0.0.0")!=0)
    {
        
        char buf[127];
        static int WP_status = -1;
        int status;
        char path[1024];
        char var [5] [20];
        memset(path, 0x00, sizeof(path));

        if (WP_status < 2)
        {
            if (e3dc_config.debug) printf("W1");
            mfp == NULL;
            sprintf(buf,"mosquitto_sub -h %s -t E3DC-Control/Grid -W 1 -C 1",e3dc_config.mqtt3_ip);
            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 %s %s %s %s ", var[0], var[1], var[2], var[3], var[4]);
                for (int x1=0;x1<status;x1++)
                    f[x1]=atof(var[x1]);
            }
        //        if (WP_status < 2)
        if (mfp != NULL)
            pclose(mfp);
        if (e3dc_config.debug) printf("W2");
        WP_status = 0;
        return status;

    }
    return -1;
}

// Assembly:
subq $0x528, %rsp            # imm = 0x528
movq %rdi, 0x518(%rsp)
leaq 0x66732(%rip), %rdi     # 0x6e998
leaq 0x580aa(%rip), %rsi     # 0x60317
callq 0x23c0
cmpl $0x0, %eax
je 0x840e
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x2170
cmpl $0x2, 0x660c2(%rip)     # 0x6e358
jge 0x82f5
testb $0x1, 0x66bc2(%rip)     # 0x6ee61
je 0x82af
leaq 0x588cd(%rip), %rdi     # 0x60b75
movb $0x0, %al
callq 0x2040
leaq 0x490(%rsp), %rdi
leaq 0x588ba(%rip), %rsi     # 0x60b78
leaq 0x6666f(%rip), %rdx     # 0x6e934
addq $0x64, %rdx
movb $0x0, %al
callq 0x2060
leaq 0x490(%rsp), %rdi
leaq 0x58524(%rip), %rsi     # 0x60803
callq 0x20b0
movq %rax, 0x68c4d(%rip)     # 0x70f38
movl $0x2, 0x66063(%rip)     # 0x6e358
cmpq $0x0, 0x68c3b(%rip)     # 0x70f38
je 0x83c7
jmp 0x8305
leaq 0x80(%rsp), %rdi
movq 0x68c24(%rip), %rdx     # 0x70f38
movl $0x400, %esi            # imm = 0x400
callq 0x2450
cmpq $0x0, %rax
je 0x83c5
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x10(%rsp), %rcx
addq $0x14, %rcx
leaq 0x10(%rsp), %r8
addq $0x28, %r8
leaq 0x10(%rsp), %r9
addq $0x3c, %r9
leaq 0x10(%rsp), %rax
addq $0x50, %rax
leaq 0x5884b(%rip), %rsi     # 0x60bab
movq %rax, (%rsp)
movb $0x0, %al
callq 0x22b0
movl %eax, 0x48c(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x48c(%rsp), %eax
jge 0x83c0
movslq 0xc(%rsp), %rax
leaq 0x10(%rsp), %rdi
imulq $0x14, %rax, %rax
addq %rax, %rdi
callq 0x2330
cvtsd2ss %xmm0, %xmm0
movq 0x518(%rsp), %rax
movslq 0xc(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x837a
jmp 0x8305
jmp 0x83c7
cmpq $0x0, 0x68b69(%rip)     # 0x70f38
je 0x83dd
movq 0x68b60(%rip), %rdi     # 0x70f38
callq 0x23d0
testb $0x1, 0x66a7d(%rip)     # 0x6ee61
je 0x83f4
leaq 0x587ce(%rip), %rdi     # 0x60bbb
movb $0x0, %al
callq 0x2040
movl $0x0, 0x65f5a(%rip)     # 0x6e358
movl 0x48c(%rsp), %eax
movl %eax, 0x524(%rsp)
jmp 0x8419
movl $0xffffffff, 0x524(%rsp) # imm = 0xFFFFFFFF
movl 0x524(%rsp), %eax
addq $0x528, %rsp            # imm = 0x528
retq
nopl (%rax,%rax)