// File: /workspace/github_c_makefile_star2_O0/back1127[P]linkedge-thing-access-websocket_client_sdk/demo/linux/demo.c
// Function: thread_report
void *thread_report(void *arg) {
    int count, i;
    char *pk, *dn;
    leda_device_data_t property[2];

    pthread_detach(pthread_self());
    
    count = g_devices_count;
    
    snprintf(property[0].key, MAX_PARAM_NAME_LENGTH, "brightness");
    property[0].type = LEDA_TYPE_INT;
    snprintf(property[1].key, MAX_PARAM_NAME_LENGTH, "power");
    property[1].type = LEDA_TYPE_BOOL;
    
    while (g_running) {
        for (i = 0; i < count; i++) {
            pk = g_devices[i].pk;
            dn = g_devices[i].dn;
            if (g_devices[i].online == 1) {
                snprintf(property[0].value, MAX_PARAM_VALUE_LENGTH, "%d", get_led_brightness(pk, dn));
                snprintf(property[1].value, MAX_PARAM_VALUE_LENGTH, "%d", get_led_power(pk, dn));
                leda_report_properties(pk, dn, property, 2);
                leda_report_event(pk, dn, "ledBroken", NULL, 0);
            }
            usleep(10*1000000/count);
        }
        sleep(1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10c0, %rsp           # imm = 0x10C0
movq %rdi, -0x10(%rbp)
callq 0x1130
movq %rax, %rdi
callq 0x1190
movl 0x3b76(%rip), %eax      # 0x5198
movl %eax, -0x14(%rbp)
leaq -0x10b0(%rbp), %rdi
addq $0x4, %rdi
movl $0x40, %esi
leaq 0x19c8(%rip), %rdx      # 0x3004
movb $0x0, %al
callq 0x1050
movl $0x0, -0x10b0(%rbp)
leaq -0x10b0(%rbp), %rdi
addq $0x844, %rdi            # imm = 0x844
addq $0x4, %rdi
movl $0x40, %esi
leaq 0x19a4(%rip), %rdx      # 0x300f
movb $0x0, %al
callq 0x1050
movl $0x1, -0x86c(%rbp)
cmpl $0x0, 0x3aad(%rip)      # 0x5130
je 0x17c5
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x17b6
movq 0x3afd(%rip), %rax      # 0x51a0
movslq -0x18(%rbp), %rcx
imulq $0x3c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq 0x3ae7(%rip), %rax      # 0x51a0
movslq -0x18(%rbp), %rcx
imulq $0x3c, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movq %rax, -0x28(%rbp)
movq 0x3acd(%rip), %rax      # 0x51a0
movslq -0x18(%rbp), %rcx
imulq $0x3c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x30(%rax)
jne 0x1798
leaq -0x10b0(%rbp), %rax
addq $0x44, %rax
movq %rax, -0x10c0(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x14c0
movq -0x10c0(%rbp), %rdi
movl %eax, %ecx
movl $0x800, %esi            # imm = 0x800
leaq 0x18f9(%rip), %rdx      # 0x3015
movb $0x0, %al
callq 0x1050
leaq -0x10b0(%rbp), %rax
addq $0x844, %rax            # imm = 0x844
addq $0x44, %rax
movq %rax, -0x10b8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1420
movq -0x10b8(%rbp), %rdi
movl %eax, %ecx
movl $0x800, %esi            # imm = 0x800
leaq 0x18b8(%rip), %rdx      # 0x3015
movb $0x0, %al
callq 0x1050
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x10b0(%rbp), %rdx
movl $0x2, %ecx
callq 0x11d0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq 0x188c(%rip), %rdx      # 0x3018
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x1100
movl $0x989680, %eax         # imm = 0x989680
cltd
idivl -0x14(%rbp)
movl %eax, %edi
callq 0x1140
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1690
movl $0x1, %edi
callq 0x1120
jmp 0x167c
movq -0x8(%rbp), %rax
addq $0x10c0, %rsp           # imm = 0x10C0
popq %rbp
retq
nopw %cs:(%rax,%rax)