// File: rellla[P]E3DC-Rscp/RscpMain.cpp
// Function: handleResponseValue(RscpProtocol*, SRscpValue*, int*)
int handleResponseValue(RscpProtocol * protocol, SRscpValue * response,
			int *isAuthRequest)
{
    // check if any of the response has the error flag set and react accordingly
    if (response->dataType == RSCP::eTypeError) {
	// handle error for example access denied errors
	uint32_t uiErrorCode = protocol->getValueAsUInt32(response);
	printf("Tag 0x%08X received error code %u.\n",
	       response->tag, uiErrorCode);
	return -1;
    }
    // check the SRscpValue TAG to detect which response it is
    switch (response->tag) {
    case TAG_RSCP_AUTHENTICATION:{
	    // It is possible to check the response->dataType value to detect correct data type
	    // and call the correct function. If data type is known,
	    // the correct function can be called directly like in this case.
	    uint8_t ucAccessLevel = protocol->getValueAsUChar8(response);
	    if (ucAccessLevel > 0) {
		iAuthenticated = 1;
		*isAuthRequest = 1;
	    }
	    printf("RSCP authentitication level %i\n", ucAccessLevel);
	    break;
	}
    case TAG_EMS_POWER_PV:{
	    // response for TAG_EMS_REQ_POWER_PV
	    int32_t iPower = protocol->getValueAsInt32(response);
	    printf("EMS PV power is %i W\n", iPower);
	    break;
	}
    case TAG_EMS_POWER_BAT:{
	    // response for TAG_EMS_REQ_POWER_BAT
	    int32_t iPower = protocol->getValueAsInt32(response);
	    printf("EMS BAT power is %i W\n", iPower);
	    break;
	}
    case TAG_EMS_POWER_HOME:{
	    // response for TAG_EMS_REQ_POWER_HOME
	    int32_t iPower = protocol->getValueAsInt32(response);
	    printf("EMS house power is %i W\n", iPower);
	    break;
	}
    case TAG_EMS_POWER_GRID:{
	    // response for TAG_EMS_REQ_POWER_GRID
	    int32_t iPower = protocol->getValueAsInt32(response);
	    printf("EMS grid power is %i W\n", iPower);
	    break;
	}
    case TAG_EMS_POWER_ADD:{
	    // response for TAG_EMS_REQ_POWER_ADD
	    int32_t iPower = protocol->getValueAsInt32(response);
	    printf("EMS add power meter power is %i W\n", iPower);
	    break;
	}
    case TAG_BAT_DATA:{
	    // response for TAG_REQ_BAT_DATA
	    std::vector < SRscpValue > batteryData =
		protocol->getValueAsContainer(response);
	    for (size_t i = 0; i < batteryData.size(); ++i) {
		if (batteryData[i].dataType == RSCP::eTypeError) {
		    // handle error for example access denied errors
		    uint32_t uiErrorCode =
			protocol->getValueAsUInt32(&batteryData[i]);
		    printf("Tag 0x%08X received error code %u.\n",
			   batteryData[i].tag, uiErrorCode);
		    return -1;
		}
		handleResponseBatData(protocol, &batteryData[i]);
	    }
	    protocol->destroyValueData(batteryData);
	    break;
	}
    case TAG_EMS_GET_POWER_SETTINGS:{
	    // response for TAG_EMS_REQ_GET_POWER_SETTINGS
	    std::vector < SRscpValue > emsData =
		protocol->getValueAsContainer(response);
	    for (size_t i = 0; i < emsData.size(); ++i) {
		if (emsData[i].dataType == RSCP::eTypeError) {
		    // handle error for example access denied errors
		    uint32_t uiErrorCode =
			protocol->getValueAsUInt32(&emsData[i]);
		    printf("Tag 0x%08X received error code %u.\n",
			   emsData[i].tag, uiErrorCode);
		    return -1;
		}
		// check each ems power settings sub tag
		switch (emsData[i].tag) {
		case TAG_EMS_POWER_LIMITS_USED:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf("EMS power limits used is %i.\n",
			       weather_en);
			break;
		    }
		case TAG_EMS_MAX_CHARGE_POWER:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf("EMS max charge power is %i.\n",
			       weather_en);
			break;
		    }
		case TAG_EMS_MAX_DISCHARGE_POWER:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf("EMS max discharge power is %i.\n",
			       weather_en);
			break;
		    }
		case TAG_EMS_DISCHARGE_START_POWER:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf("EMS discharge start power is %i.\n",
			       weather_en);
			break;
		    }
		case TAG_EMS_POWERSAVE_ENABLED:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf("EMS powersave enabled is %i.\n",
			       weather_en);
			break;
		    }
		case TAG_EMS_WEATHER_REGULATED_CHARGE_ENABLED:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf
			    ("EMS weather regulated charge enabled is %i.\n",
			     weather_en);
			break;
		    }
		case TAG_EMS_UNKNOWN:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf("EMS unknown is %i.\n", weather_en);
			break;
		    }
		    // ...
		default:
		    // default behaviour
		    printf("Unknown ems tag %08X\n", emsData[i].tag);
		    break;
		}
	    }
	    protocol->destroyValueData(emsData);
	    break;
	}
    case TAG_EMS_SET_POWER_SETTINGS:{
	    // resposne for TAG_EMS_REQ_SET_POWER_SETTINGS
	    std::vector < SRscpValue > emsData =
		protocol->getValueAsContainer(response);
	    for (size_t i = 0; i < emsData.size(); ++i) {
		if (emsData[i].dataType == RSCP::eTypeError) {
		    // handle error for example access denied errors
		    uint32_t uiErrorCode =
			protocol->getValueAsUInt32(&emsData[i]);
		    printf("Tag 0x%08X received error code %u.\n",
			   emsData[i].tag, uiErrorCode);
		    return -1;
		}
		// check each battery sub tag
		switch (emsData[i].tag) {
		case TAG_EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED:{
			int8_t weather_en =
			    protocol->getValueAsInt32(&emsData[i]);
			printf
			    ("Weather regulated charge response: %i\n",
			     weather_en);
			break;
		    }
		default:
		    // default behaviour
		    printf("Unknown ems tag %08X\n", emsData[i].tag);
		    break;
		}
	    }
	    protocol->destroyValueData(emsData);
	    break;
	}
    case TAG_EMS_GET_IDLE_PERIODS:{
	    // resposne for TAG_EMS_REQ_GET_IDLE_PERIODS
	    std::vector < SRscpValue > emsData =
		protocol->getValueAsContainer(response);
	    idle_period_t periods[14];
	    for (size_t i = 0; i < emsData.size(); ++i) {
		if (emsData[i].dataType == RSCP::eTypeError) {
		    // handle error for example access denied errors
		    uint32_t uiErrorCode =
			protocol->getValueAsUInt32(&emsData[i]);
		    printf("Tag 0x%08X received error code %u.\n",
			   emsData[i].tag, uiErrorCode);
		    return -1;
		}
		handleResponseEMSGetIdlePeriods(protocol, &emsData[i], &periods[i]);
	    }
	    break;
	}
    default:
	// default behavior
	uint8_t unknown = protocol->getValueAsUChar8(response);
	printf("Unknown tag %08X -> %i.\n", response->tag, unknown);
	break;
    }
}

// Assembly:
subq $0x268, %rsp            # imm = 0x268
movq %rdi, 0x258(%rsp)
movq %rsi, 0x250(%rsp)
movq %rdx, 0x248(%rsp)
movq 0x250(%rsp), %rax
movzbl 0x4(%rax), %eax
cmpl $0xff, %eax
jne 0x3a1d
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5ec0
movl %eax, 0x244(%rsp)
movq 0x250(%rsp), %rax
movl (%rax), %esi
movl 0x244(%rsp), %edx
leaq 0x1c6b7(%rip), %rdi     # 0x200bd
movb $0x0, %al
callq 0x2040
movl $0xffffffff, 0x264(%rsp) # imm = 0xFFFFFFFF
jmp 0x4705
movq 0x250(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xfc(%rsp)
subl $0x800001, %eax         # imm = 0x800001
je 0x3af2
jmp 0x3a3b
movl 0xfc(%rsp), %eax
subl $0x1800001, %eax        # imm = 0x1800001
je 0x3b4e
jmp 0x3a4f
movl 0xfc(%rsp), %eax
subl $0x1800002, %eax        # imm = 0x1800002
je 0x3b84
jmp 0x3a63
movl 0xfc(%rsp), %eax
subl $0x1800003, %eax        # imm = 0x1800003
je 0x3bba
jmp 0x3a77
movl 0xfc(%rsp), %eax
subl $0x1800004, %eax        # imm = 0x1800004
je 0x3bf0
jmp 0x3a8b
movl 0xfc(%rsp), %eax
subl $0x1800005, %eax        # imm = 0x1800005
je 0x3c26
jmp 0x3a9f
movl 0xfc(%rsp), %eax
subl $0x1800080, %eax        # imm = 0x1800080
je 0x4514
jmp 0x3ab3
movl 0xfc(%rsp), %eax
subl $0x180008b, %eax        # imm = 0x180008B
je 0x3e2d
jmp 0x3ac7
movl 0xfc(%rsp), %eax
subl $0x180008c, %eax        # imm = 0x180008C
je 0x42e9
jmp 0x3adb
movl 0xfc(%rsp), %eax
subl $0x3840000, %eax        # imm = 0x3840000
je 0x3c5c
jmp 0x46c7
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5ef0
movb %al, 0x243(%rsp)
movzbl 0x243(%rsp), %eax
cmpl $0x0, %eax
jle 0x3b33
movl $0x1, 0x20b73(%rip)     # 0x24698
movq 0x248(%rsp), %rax
movl $0x1, (%rax)
movzbl 0x243(%rsp), %esi
leaq 0x1c791(%rip), %rdi     # 0x202d3
movb $0x0, %al
callq 0x2040
jmp 0x4703
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5fb0
movl %eax, 0x23c(%rsp)
movl 0x23c(%rsp), %esi
leaq 0x1c77b(%rip), %rdi     # 0x202f3
movb $0x0, %al
callq 0x2040
jmp 0x4703
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5fb0
movl %eax, 0x238(%rsp)
movl 0x238(%rsp), %esi
leaq 0x1c75b(%rip), %rdi     # 0x20309
movb $0x0, %al
callq 0x2040
jmp 0x4703
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5fb0
movl %eax, 0x234(%rsp)
movl 0x234(%rsp), %esi
leaq 0x1c73c(%rip), %rdi     # 0x20320
movb $0x0, %al
callq 0x2040
jmp 0x4703
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5fb0
movl %eax, 0x230(%rsp)
movl 0x230(%rsp), %esi
leaq 0x1c71f(%rip), %rdi     # 0x20339
movb $0x0, %al
callq 0x2040
jmp 0x4703
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5fb0
movl %eax, 0x22c(%rsp)
movl 0x22c(%rsp), %esi
leaq 0x1c701(%rip), %rdi     # 0x20351
movb $0x0, %al
callq 0x2040
jmp 0x4703
movq 0x258(%rsp), %rsi
movq 0x250(%rsp), %rdx
leaq 0x210(%rsp), %rdi
callq 0x5de0
movq $0x0, 0x208(%rsp)
movq 0x208(%rsp), %rax
movq %rax, 0xf0(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x5e80
movq %rax, %rcx
movq 0xf0(%rsp), %rax
cmpq %rcx, %rax
jae 0x3de7
movq 0x208(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x5ea0
movzbl 0x4(%rax), %eax
cmpl $0xff, %eax
jne 0x3d95
movq 0x258(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x5ea0
movq 0xe0(%rsp), %rdi
movq %rax, %rsi
callq 0x5ec0
movl %eax, 0xec(%rsp)
jmp 0x3d18
movl 0xec(%rsp), %eax
movl %eax, 0x204(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x5ea0
movl (%rax), %esi
movl 0x204(%rsp), %edx
leaq 0x1c372(%rip), %rdi     # 0x200bd
xorl %eax, %eax
callq 0x2040
jmp 0x3d54
movl $0xffffffff, 0x264(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x1f0(%rsp)
jmp 0x3e09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x5f20
jmp 0x4714
movq 0x258(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x5ea0
movq 0xd8(%rsp), %rdi
movq %rax, %rsi
callq 0x37e0
jmp 0x3dcc
jmp 0x3dce
movq 0x208(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x208(%rsp)
jmp 0x3c85
movq 0x258(%rsp), %rdi
leaq 0x210(%rsp), %rsi
callq 0x8a20
jmp 0x3dfe
movl $0x2, 0x1f0(%rsp)
leaq 0x210(%rsp), %rdi
callq 0x5f20
movl 0x1f0(%rsp), %eax
subl $0x1, %eax
je 0x4705
jmp 0x3e28
jmp 0x4703
movq 0x258(%rsp), %rsi
movq 0x250(%rsp), %rdx
leaq 0x1d8(%rsp), %rdi
callq 0x5de0
movq $0x0, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0xd0(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x5e80
movq %rax, %rcx
movq 0xd0(%rsp), %rax
cmpq %rcx, %rax
jae 0x42a3
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movzbl 0x4(%rax), %eax
cmpl $0xff, %eax
jne 0x3f66
movq 0x258(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0xc0(%rsp), %rdi
movq %rax, %rsi
callq 0x5ec0
movl %eax, 0xcc(%rsp)
jmp 0x3ee9
movl 0xcc(%rsp), %eax
movl %eax, 0x1cc(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movl (%rax), %esi
movl 0x1cc(%rsp), %edx
leaq 0x1c1a1(%rip), %rdi     # 0x200bd
xorl %eax, %eax
callq 0x2040
jmp 0x3f25
movl $0xffffffff, 0x264(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x1f0(%rsp)
jmp 0x42c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x5f20
jmp 0x4714
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movl (%rax), %eax
addl $0xfeffff00, %eax       # imm = 0xFEFFFF00
movl %eax, %ecx
movq %rcx, 0xb8(%rsp)
subl $0x6, %eax
ja 0x425f
movq 0xb8(%rsp), %rax
leaq 0x1c07c(%rip), %rcx     # 0x20020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x258(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0xa8(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0xb4(%rsp)
jmp 0x3feb
movl 0xb4(%rsp), %eax
movb %al, 0x1cb(%rsp)
movsbl 0x1cb(%rsp), %esi
leaq 0x1c36c(%rip), %rdi     # 0x20374
xorl %eax, %eax
callq 0x2040
jmp 0x4011
jmp 0x4288
movq 0x258(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0xa4(%rsp)
jmp 0x4054
movl 0xa4(%rsp), %eax
movb %al, 0x1ca(%rsp)
movsbl 0x1ca(%rsp), %esi
leaq 0x1c321(%rip), %rdi     # 0x20392
xorl %eax, %eax
callq 0x2040
jmp 0x407a
jmp 0x4288
movq 0x258(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0x88(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0x94(%rsp)
jmp 0x40bd
movl 0x94(%rsp), %eax
movb %al, 0x1c9(%rsp)
movsbl 0x1c9(%rsp), %esi
leaq 0x1c2d5(%rip), %rdi     # 0x203af
xorl %eax, %eax
callq 0x2040
jmp 0x40e3
jmp 0x4288
movq 0x258(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0x78(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0x84(%rsp)
jmp 0x4120
movl 0x84(%rsp), %eax
movb %al, 0x1c8(%rsp)
movsbl 0x1c8(%rsp), %esi
leaq 0x1c292(%rip), %rdi     # 0x203cf
xorl %eax, %eax
callq 0x2040
jmp 0x4146
jmp 0x4288
movq 0x258(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0x74(%rsp)
jmp 0x4180
movl 0x74(%rsp), %eax
movb %al, 0x1c7(%rsp)
movsbl 0x1c7(%rsp), %esi
leaq 0x1c257(%rip), %rdi     # 0x203f1
xorl %eax, %eax
callq 0x2040
jmp 0x41a3
jmp 0x4288
movq 0x258(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0x64(%rsp)
jmp 0x41dd
movl 0x64(%rsp), %eax
movb %al, 0x1c6(%rsp)
movsbl 0x1c6(%rsp), %esi
leaq 0x1c218(%rip), %rdi     # 0x2040f
xorl %eax, %eax
callq 0x2040
jmp 0x4200
jmp 0x4288
movq 0x258(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0x54(%rsp)
jmp 0x423a
movl 0x54(%rsp), %eax
movb %al, 0x1c5(%rsp)
movsbl 0x1c5(%rsp), %esi
leaq 0x1c1e8(%rip), %rdi     # 0x2043c
xorl %eax, %eax
callq 0x2040
jmp 0x425d
jmp 0x4288
movq 0x1d0(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x5ea0
movl (%rax), %esi
leaq 0x1c1d3(%rip), %rdi     # 0x20450
xorl %eax, %eax
callq 0x2040
jmp 0x4286
jmp 0x4288
jmp 0x428a
movq 0x1d0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1d0(%rsp)
jmp 0x3e56
movq 0x258(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x8a20
jmp 0x42ba
movl $0x2, 0x1f0(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x5f20
movl 0x1f0(%rsp), %eax
subl $0x1, %eax
je 0x4705
jmp 0x42e4
jmp 0x4703
movq 0x258(%rsp), %rsi
movq 0x250(%rsp), %rdx
leaq 0x1a8(%rsp), %rdi
callq 0x5de0
movq $0x0, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x5e80
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jae 0x44ce
movq 0x1a0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x5ea0
movzbl 0x4(%rax), %eax
cmpl $0xff, %eax
jne 0x4410
movq 0x258(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x1a0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x5ea0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x5ec0
movl %eax, 0x3c(%rsp)
jmp 0x4396
movl 0x3c(%rsp), %eax
movl %eax, 0x19c(%rsp)
movq 0x1a0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x5ea0
movl (%rax), %esi
movl 0x19c(%rsp), %edx
leaq 0x1bcf7(%rip), %rdi     # 0x200bd
xorl %eax, %eax
callq 0x2040
jmp 0x43cf
movl $0xffffffff, 0x264(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x1f0(%rsp)
jmp 0x44f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x5f20
jmp 0x4714
movq 0x1a0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x5ea0
movl (%rax), %eax
subl $0x1800105, %eax        # imm = 0x1800105
jne 0x448a
jmp 0x4430
movq 0x258(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x1a0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x5ea0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x5fb0
movl %eax, 0x2c(%rsp)
jmp 0x4465
movl 0x2c(%rsp), %eax
movb %al, 0x19b(%rsp)
movsbl 0x19b(%rsp), %esi
leaq 0x1bfe7(%rip), %rdi     # 0x20466
xorl %eax, %eax
callq 0x2040
jmp 0x4488
jmp 0x44b3
movq 0x1a0(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x5ea0
movl (%rax), %esi
leaq 0x1bfa8(%rip), %rdi     # 0x20450
xorl %eax, %eax
callq 0x2040
jmp 0x44b1
jmp 0x44b3
jmp 0x44b5
movq 0x1a0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x1a0(%rsp)
jmp 0x4312
movq 0x258(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x8a20
jmp 0x44e5
movl $0x2, 0x1f0(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x5f20
movl 0x1f0(%rsp), %eax
subl $0x1, %eax
je 0x4705
jmp 0x450f
jmp 0x4703
movq 0x258(%rsp), %rsi
movq 0x250(%rsp), %rdx
leaq 0x180(%rsp), %rdi
callq 0x5de0
movq $0x0, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x5e80
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x469f
movq 0x108(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0x5ea0
movzbl 0x4(%rax), %eax
cmpl $0xff, %eax
jne 0x463b
movq 0x258(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x108(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0x5ea0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x5ec0
movl %eax, 0x14(%rsp)
jmp 0x45c1
movl 0x14(%rsp), %eax
movl %eax, 0x104(%rsp)
movq 0x108(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0x5ea0
movl (%rax), %esi
movl 0x104(%rsp), %edx
leaq 0x1bacc(%rip), %rdi     # 0x200bd
xorl %eax, %eax
callq 0x2040
jmp 0x45fa
movl $0xffffffff, 0x264(%rsp) # imm = 0xFFFFFFFF
movl $0x1, 0x1f0(%rsp)
jmp 0x46aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f8(%rsp)
movl %eax, 0x1f4(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x5f20
jmp 0x4714
movq 0x258(%rsp), %rax
movq %rax, (%rsp)
movq 0x108(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0x5ea0
movq (%rsp), %rdi
movq %rax, %rsi
movq 0x108(%rsp), %rcx
movq %rcx, %rax
shlq $0x3, %rax
subq %rcx, %rax
leaq 0x110(%rsp,%rax), %rdx
callq 0x2cd0
jmp 0x4684
jmp 0x4686
movq 0x108(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x108(%rsp)
jmp 0x453d
movl $0x2, 0x1f0(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x5f20
movl 0x1f0(%rsp), %eax
subl $0x1, %eax
je 0x4705
jmp 0x46c5
jmp 0x4703
movq 0x258(%rsp), %rdi
movq 0x250(%rsp), %rsi
callq 0x5ef0
movb %al, 0x103(%rsp)
movq 0x250(%rsp), %rax
movl (%rax), %esi
movzbl 0x103(%rsp), %edx
leaq 0x1bd91(%rip), %rdi     # 0x2048d
movb $0x0, %al
callq 0x2040
ud2
movl 0x264(%rsp), %eax
addq $0x268, %rsp            # imm = 0x268
retq
movq 0x1f8(%rsp), %rdi
callq 0x22a0
nopw %cs:(%rax,%rax)