// File: /workspace/github_c_makefile_star2_O3/wjmelements[P]evm/src/evm.c
// Function: fprintLogDiff
uint16_t fprintLogDiff(FILE *file, const logChanges_t *log, const logChanges_t *expected, int showLogIndex) {
    if (log == NULL) {
        return 0;
    }
    if (expected == NULL) {
        return fprintLog(file, log, showLogIndex);
    }
    uint16_t items = fprintLogDiff(file, log->prev, expected->prev, showLogIndex);
    if (items) {
        fputc(',', file);
    }
    if (showLogIndex) {
        fprintf(file, "{\"logIndex\":\"0x%x\",\"data\":\"0x", log->logIndex);
    } else {
        fprintf(file, "{\"data\":\"0x");
    }
    if (log->data.size == expected->data.size) {
        for (size_t i = 0; i < log->data.size; i++) {
            if (log->data.content[i] == expected->data.content[i]) {
                fprintf(file, "%02x", log->data.content[i]);
            } else {
                fprintf(file, "\033[0;31m%02x\033[0m", log->data.content[i]);
            }
        }
    } else {
        for (size_t i = 0; i < log->data.size; i++) {
            fprintf(file, "%02x", log->data.content[i]);
        }
    }
    fputs("\",\"topics\":[", file);
    if (log->topicCount == expected->topicCount) {
        for (uint8_t i = log->topicCount; i-->0;) {
            fputs("\"0x", file);
            for (uint16_t j = 0; j < 32; j++) {
                uint64_t topicPart = log->topics[i].elements[j / 16].elements[(j % 16) / 8];
                topicPart >>= (56 - 8 * (j % 8));
                topicPart &= 0xff;
                uint64_t expectedPart = expected->topics[i].elements[j / 16].elements[(j % 16) / 8];
                expectedPart >>= (56 - 8 * (j % 8));
                expectedPart &= 0xff;
                if (topicPart == expectedPart) {
                    fprintf(file, "%02" PRIx64, topicPart);
                } else {
                    fprintf(file, "\033[0;31m%02" PRIx64 "\033[0m", topicPart);
                }
            }
            fputc('"', file);
            if (i) {
                fputc(',', file);
            }
        }
    } else {
        for (uint8_t i = log->topicCount; i-->0;) {
            fprintf(file, "\"0x%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "\"",
                UPPER(UPPER(log->topics[i])),
                LOWER(UPPER(log->topics[i])),
                UPPER(LOWER(log->topics[i])),
                LOWER(LOWER(log->topics[i]))
            );
            if (i) {
                fputc(',', file);
            }
        }
    }
    fputs("]}", file);
    return items + 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x7bb7
movl %ecx, %r12d
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %rbx
testq %rdx, %rdx
je 0x7bbe
movq 0x20(%rbp), %rsi
movq 0x20(%r15), %rdx
movq %rbx, %rdi
movl %r12d, %ecx
callq 0x7b4f
movl %eax, %r14d
testw %ax, %ax
je 0x7b9b
movl $0x2c, %edi
movq %rbx, %rsi
callq 0x3180
testl %r12d, %r12d
je 0x7bda
movzwl 0xa(%rbp), %edx
leaq 0xad91(%rip), %rsi      # 0x1293c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x31d0
jmp 0x7bf3
xorl %eax, %eax
jmp 0x7e2b
movq %rbx, %rdi
movq %rbp, %rsi
movl %r12d, %edx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x79f4
leaq 0xad79(%rip), %rdi      # 0x1295a
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3290
movq %rbx, %r12
movq 0x10(%rbp), %rax
movq %r15, 0x8(%rsp)
cmpq 0x10(%r15), %rax
movl %r14d, 0x14(%rsp)
jne 0x7c59
testq %rax, %rax
movq %r12, %r13
je 0x7c88
leaq 0xa765(%rip), %rbx      # 0x1237e
leaq 0xad73(%rip), %r14      # 0x12993
xorl %r15d, %r15d
movq 0x18(%rbp), %rax
movzbl (%rax,%r15), %edx
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rbx, %rsi
cmpb (%rax,%r15), %dl
je 0x7c41
movq %r14, %rsi
movq %r12, %r13
movq %r12, %rdi
xorl %eax, %eax
callq 0x31d0
incq %r15
cmpq 0x10(%rbp), %r15
jb 0x7c23
jmp 0x7c88
testq %rax, %rax
movq %r12, %r13
je 0x7c88
leaq 0xa716(%rip), %r12      # 0x1237e
xorl %ebx, %ebx
movq 0x18(%rbp), %rax
movzbl (%rax,%rbx), %edx
movq %r13, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x31d0
incq %rbx
cmpq 0x10(%rbp), %rbx
jb 0x7c6a
leaq 0xacd7(%rip), %rdi      # 0x12966
movq %r13, %rsi
callq 0x3130
movq %rbp, (%rsp)
movzbl 0x8(%rbp), %r14d
movq 0x8(%rsp), %rax
cmpb 0x8(%rax), %r14b
jne 0x7d86
testq %r14, %r14
je 0x7e16
movq %r13, 0x18(%rsp)
movq 0x8(%rsp), %rbp
movl $0xff, %r12d
decq %r14
leaq 0xa4d2(%rip), %rdi      # 0x121a4
movq %r13, %rsi
callq 0x3130
movq %r14, 0x20(%rsp)
shlq $0x5, %r14
xorl %ebx, %ebx
xorl %r15d, %r15d
movq (%rsp), %r13
movq (%r13), %rax
addq %r14, %rax
movl %r15d, %esi
andl $-0x10, %esi
addq %rsi, %rax
movl %r15d, %edi
andl $0x8, %edi
movq (%rdi,%rax), %rdx
movl %ebx, %ecx
notb %cl
andb $0x38, %cl
shrq %cl, %rdx
andq %r12, %rdx
movq (%rbp), %rax
addq %r14, %rax
addq %rsi, %rax
movq (%rdi,%rax), %rax
shrq %cl, %rax
andq %r12, %rax
cmpq %rax, %rdx
leaq 0xac78(%rip), %rsi      # 0x129a9
leaq 0xac6b(%rip), %rax      # 0x129a3
cmoveq %rax, %rsi
movq 0x18(%rsp), %rdi
xorl %eax, %eax
callq 0x31d0
incl %r15d
addl $0x8, %ebx
cmpl $0x20, %r15d
jne 0x7cec
movl $0x22, %edi
movq 0x18(%rsp), %r13
movq %r13, %rsi
callq 0x3180
movq 0x20(%rsp), %r14
testq %r14, %r14
je 0x7e16
movl $0x2c, %edi
movq %r13, %rsi
callq 0x3180
jmp 0x7cc8
testq %r14, %r14
je 0x7e16
leaq -0x1(%r14), %r12
movq (%rsp), %rax
movq (%rax), %rax
movq %r12, %rsi
shlq $0x5, %rsi
movq (%rax,%rsi), %rdx
movq 0x8(%rax,%rsi), %rcx
movq 0x10(%rax,%rsi), %r8
movq 0x18(%rax,%rsi), %r9
leaq 0xabb8(%rip), %rsi      # 0x12973
movq %r13, %rdi
xorl %eax, %eax
callq 0x31d0
testq %r12, %r12
je 0x7e16
shll $0x5, %r14d
addq $-0x28, %r14
leaq 0xab9a(%rip), %r15      # 0x12973
movl $0x2c, %edi
movq %r13, %rsi
callq 0x3180
movq (%rsp), %rax
movq (%rax), %rax
movq -0x18(%rax,%r14), %rdx
movq -0x10(%rax,%r14), %rcx
movq -0x8(%rax,%r14), %r8
movq (%rax,%r14), %r9
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x31d0
addq $-0x20, %r14
decq %r12
jne 0x7dd9
leaq 0xab73(%rip), %rdi      # 0x12990
movq %r13, %rsi
callq 0x3130
movl 0x14(%rsp), %eax
incl %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq