// File: /workspace/github_c_makefile_star2_O3/Carton32[P]quectel-CM/udhcpc.c
// Function: update_ip_address_by_qmi
static void update_ip_address_by_qmi(const char *ifname, const IPV4_T *ipv4, const IPV6_T *ipv6) {
    char *d1, *d2;

    if (ipv4 && ipv4->Address) {
        d1 = strdup(ipv4Str(ipv4->Address));
        d2 = strdup(ipv4Str(ipv4->Gateway));
        unsigned prefix = 0;
        unsigned n = 0;

        for (n = 0; n < 32; n++) {
            if (ipv4->SubnetMask&(1<<n)) {
                prefix++;
            }
        }

        update_ipv4_address(ifname, d1, d2, prefix);
        free(d1); free(d2);

        //Adding DNS
        if (ipv4->DnsPrimary) {
            d1 = strdup(ipv4Str(ipv4->DnsPrimary));
            d2 = strdup(ipv4Str(ipv4->DnsSecondary ? ipv4->DnsSecondary : ipv4->DnsPrimary));
            update_resolv_conf(4, ifname, d1, d2);
            free(d1); free(d2);
        }
    }

    if (ipv6 && ipv6->Address[0] && ipv6->PrefixLengthIPAddr) {
        d1 = strdup(ipv6Str(ipv6->Address));
        d2 = strdup(ipv6Str(ipv6->Gateway));

        update_ipv6_address(ifname, d1, d2, ipv6->PrefixLengthIPAddr);
        free(d1); free(d2);

        //Adding DNS
        if (ipv6->DnsPrimary[0]) {
            d1 = strdup(ipv6Str(ipv6->DnsPrimary));
            d2 = strdup(ipv6Str(ipv6->DnsSecondary[0] ? ipv6->DnsSecondary : ipv6->DnsPrimary));
            update_resolv_conf(6, ifname, d1, d2);
            free(d1); free(d2);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0x1cfa2
movq %rsi, %r15
movl (%rsi), %eax
testl %eax, %eax
je 0x1cfa2
movq %rbx, 0x10(%rsp)
movl %eax, %r9d
shrl $0x8, %r9d
movl %eax, %r8d
shrl $0x10, %r8d
movl %eax, %ecx
shrl $0x18, %ecx
movl $0xff, %ebx
andl %ebx, %r8d
andl %ebx, %r9d
andl %ebx, %eax
movl %eax, (%rsp)
leaq 0xd569(%rip), %r13      # 0x2a320
leaq 0x64f0(%rip), %rbp      # 0x232ae
movl $0x10, %esi
movq %r13, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x51c0
movq %r13, %rdi
callq 0x5520
movq %rax, %r12
movl 0x4(%r15), %eax
movl %eax, %r9d
shrl $0x8, %r9d
movl %eax, %r8d
shrl $0x10, %r8d
movl %eax, %ecx
shrl $0x18, %ecx
andl %ebx, %r8d
andl %ebx, %r9d
andl %ebx, %eax
movl %eax, (%rsp)
movl $0x10, %esi
movq %r13, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x51c0
movq %r13, %rdi
callq 0x5520
movq %rax, %r13
movd 0x8(%r15), %xmm0
pshufd $0x0, %xmm0, %xmm1      # xmm1 = xmm0[0,0,0,0]
pxor %xmm0, %xmm0
movdqa 0x679f(%rip), %xmm2     # 0x235d0
movl $0x20, %eax
movaps 0x67a3(%rip), %xmm3     # 0x235e0
movdqa 0x67ab(%rip), %xmm4     # 0x235f0
pshuflw $0xfe, %xmm2, %xmm5     # xmm5 = xmm2[2,3,3,3,4,5,6,7]
movdqa %xmm1, %xmm6
psrld %xmm5, %xmm6
pshuflw $0x54, %xmm2, %xmm5     # xmm5 = xmm2[0,1,1,1,4,5,6,7]
movdqa %xmm1, %xmm7
psrld %xmm5, %xmm7
punpcklqdq %xmm6, %xmm7    # xmm7 = xmm7[0],xmm6[0]
pshufd $0xee, %xmm2, %xmm5     # xmm5 = xmm2[2,3,2,3]
pshuflw $0xfe, %xmm5, %xmm6     # xmm6 = xmm5[2,3,3,3,4,5,6,7]
movdqa %xmm1, %xmm8
psrld %xmm6, %xmm8
pshuflw $0x54, %xmm5, %xmm5     # xmm5 = xmm5[0,1,1,1,4,5,6,7]
movdqa %xmm1, %xmm6
psrld %xmm5, %xmm6
punpckhqdq %xmm8, %xmm6    # xmm6 = xmm6[1],xmm8[1]
shufps $0xcc, %xmm6, %xmm7     # xmm7 = xmm7[0,3],xmm6[0,3]
andps %xmm3, %xmm7
paddd %xmm7, %xmm0
paddd %xmm4, %xmm2
addl $-0x4, %eax
jne 0x1ce45
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddd %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
paddd %xmm1, %xmm0
movd %xmm0, %ecx
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1bfa4
movq %r12, %rdi
callq 0x5040
movq %r13, %rdi
callq 0x5040
movl 0xc(%r15), %eax
testl %eax, %eax
je 0x1cfa2
movl %eax, %r9d
shrl $0x8, %r9d
movl %eax, %r8d
shrl $0x10, %r8d
movl %eax, %ecx
shrl $0x18, %ecx
movl $0xff, %ebp
andl %ebp, %r8d
andl %ebp, %r9d
andl %ebp, %eax
movl %eax, (%rsp)
leaq 0xd414(%rip), %r12      # 0x2a320
leaq 0x639b(%rip), %rdx      # 0x232ae
movl $0x10, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x51c0
movq %r12, %rdi
callq 0x5520
movq %rax, %r12
movl 0x10(%r15), %eax
testl %eax, %eax
jne 0x1cf39
movl 0xc(%r15), %eax
movl %eax, %r9d
shrl $0x8, %r9d
movl %eax, %r8d
shrl $0x10, %r8d
movl %eax, %ecx
shrl $0x18, %ecx
andl %ebp, %r8d
andl %ebp, %r9d
andl %ebp, %eax
movl %eax, (%rsp)
leaq 0xd3c2(%rip), %r15      # 0x2a320
leaq 0x6349(%rip), %rdx      # 0x232ae
movl $0x10, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x51c0
movq %r15, %rdi
callq 0x5520
movq %rax, %r15
movl $0x4, %edi
movq %rbx, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0xee84
movq %r12, %rdi
callq 0x5040
movq %r15, %rdi
callq 0x5040
testq %r14, %r14
je 0x1d06b
cmpb $0x0, (%r14)
je 0x1d06b
cmpb $0x0, 0x50(%r14)
je 0x1d06b
movq %r14, %rdi
callq 0x1cce4
leaq 0xf421(%rip), %rdi      # 0x2c3f0
callq 0x5520
movq %rax, %r15
leaq 0x10(%r14), %rdi
callq 0x1cce4
movzbl 0x50(%r14), %ecx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1c144
movq %r15, %rdi
callq 0x5040
cmpb $0x0, 0x30(%r14)
je 0x1d06b
leaq 0x30(%r14), %r15
movq %r15, %rdi
callq 0x1cce4
leaq 0xf3de(%rip), %r12      # 0x2c3f0
movq %r12, %rdi
callq 0x5520
movq %rax, %r13
leaq 0x40(%r14), %rdi
cmpb $0x0, 0x40(%r14)
cmoveq %r15, %rdi
callq 0x1cce4
movq %r12, %rdi
callq 0x5520
movq %rax, %r14
movl $0x6, %edi
movq %rbx, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0xee84
movq %r13, %rdi
callq 0x5040
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5040
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq