// File: /workspace/github_c_makefile_star2_O0/joncampbell123[P]swfhax/swf.c
// Function: swf_reader_read_SHAPE_record
int swf_reader_read_SHAPE_record(swf_reader *swf,swf_SHAPE_reading *r) {
	unsigned int tmp;

	r->ShapeRecord_str = "EndShapeRecord";
	r->ShapeRecord_type = swf_shrec_EndShapeRecord;
	r->ShapeRecordTypeFlag = swf_reader_read_UB(swf,1);
	if (r->ShapeRecordTypeFlag == 0) {
		r->shrec.style.StyleChangeRecord.StateNewStyles = swf_reader_read_UB(swf,1);
		r->shrec.style.StyleChangeRecord.StateLineStyle = swf_reader_read_UB(swf,1);
		r->shrec.style.StyleChangeRecord.StateFillStyle1 = swf_reader_read_UB(swf,1);
		r->shrec.style.StyleChangeRecord.StateFillStyle0 = swf_reader_read_UB(swf,1);
		r->shrec.style.StyleChangeRecord.StateMoveTo = swf_reader_read_UB(swf,1);
		/* EndShapeRecord TypeFlag == 0, followed by 5 bits of 0 */
		if (r->shrec.style.StyleChangeRecord.StateNewStyles == 0 &&
			r->shrec.style.StyleChangeRecord.StateLineStyle == 0 &&
			r->shrec.style.StyleChangeRecord.StateFillStyle1 == 0 &&
			r->shrec.style.StyleChangeRecord.StateFillStyle0 == 0 &&
			r->shrec.style.StyleChangeRecord.StateMoveTo == 0) {
			r->shrec.style.EndShapeRecord.EndOfShape = 0;
			return 0;
		}

		/* StyleChangeRecord TypeFlag == 0, 5 bits at least 1 is nonzero */
		r->ShapeRecord_str = "StyleChangeRecord";
		r->ShapeRecord_type = swf_shrec_StyleChangeRecord;
		if (r->shrec.style.StyleChangeRecord.StateMoveTo) {
			r->shrec.style.StyleChangeRecord.MoveBits = swf_reader_read_UB(swf,5);
			r->shrec.style.StyleChangeRecord.MoveDeltaX = swf_reader_read_SB(swf,r->shrec.style.StyleChangeRecord.MoveBits);
			r->shrec.style.StyleChangeRecord.MoveDeltaY = swf_reader_read_SB(swf,r->shrec.style.StyleChangeRecord.MoveBits);
		}
		else {
			r->shrec.style.StyleChangeRecord.MoveBits = 0;
			r->shrec.style.StyleChangeRecord.MoveDeltaX = 0;
			r->shrec.style.StyleChangeRecord.MoveDeltaY = 0;
		}
		if (r->shrec.style.StyleChangeRecord.StateFillStyle0)
			r->shrec.style.StyleChangeRecord.FillStyle0 = swf_reader_read_UB(swf,r->NumFillBits);
		if (r->shrec.style.StyleChangeRecord.StateFillStyle1)
			r->shrec.style.StyleChangeRecord.FillStyle1 = swf_reader_read_UB(swf,r->NumFillBits);
		if (r->shrec.style.StyleChangeRecord.StateLineStyle)
			r->shrec.style.StyleChangeRecord.LineStyle = swf_reader_read_UB(swf,r->NumLineBits);
	}
	else {
		tmp = swf_reader_read_UB(swf,1);
		if (tmp) { /* StraightEdgeRecord TypeFlag == 1, StraightFlag == 1, 5 bits */
			r->ShapeRecord_str = "StraightEdgeRecord";
			r->ShapeRecord_type = swf_shrec_StraightEdgeRecord;
			r->shrec.edge.StraightEdgeRecord.StraightFlag = 1;
			r->shrec.edge.StraightEdgeRecord.NumBits = swf_reader_read_UB(swf,4) + 2;
			r->shrec.edge.StraightEdgeRecord.GeneralLineFlag = swf_reader_read_UB(swf,1);
			if (r->shrec.edge.StraightEdgeRecord.GeneralLineFlag == 0)
				r->shrec.edge.StraightEdgeRecord.VertLineFlag = swf_reader_read_UB(swf,1);
			if (r->shrec.edge.StraightEdgeRecord.GeneralLineFlag || r->shrec.edge.StraightEdgeRecord.VertLineFlag == 0)
				r->shrec.edge.StraightEdgeRecord.DeltaX = swf_reader_read_SB(swf,r->shrec.edge.StraightEdgeRecord.NumBits);
			else
				r->shrec.edge.StraightEdgeRecord.DeltaX = 0;
			if (r->shrec.edge.StraightEdgeRecord.GeneralLineFlag || r->shrec.edge.StraightEdgeRecord.VertLineFlag == 1)
				r->shrec.edge.StraightEdgeRecord.DeltaY = swf_reader_read_SB(swf,r->shrec.edge.StraightEdgeRecord.NumBits);
			else
				r->shrec.edge.StraightEdgeRecord.DeltaY = 0;
		}
		else {
			r->ShapeRecord_str = "CurvedEdgeRecord";
			r->ShapeRecord_type = swf_shrec_CurvedEdgeRecord;
			r->shrec.edge.CurvedEdgeRecord.StraightFlag = 0;
			r->shrec.edge.CurvedEdgeRecord.NumBits = swf_reader_read_UB(swf,4) + 2;
			r->shrec.edge.CurvedEdgeRecord.ControlDeltaX = swf_reader_read_SB(swf,r->shrec.edge.CurvedEdgeRecord.NumBits);
			r->shrec.edge.CurvedEdgeRecord.ControlDeltaY = swf_reader_read_SB(swf,r->shrec.edge.CurvedEdgeRecord.NumBits);
			r->shrec.edge.CurvedEdgeRecord.AnchorDeltaX = swf_reader_read_SB(swf,r->shrec.edge.CurvedEdgeRecord.NumBits);
			r->shrec.edge.CurvedEdgeRecord.AnchorDeltaY = swf_reader_read_SB(swf,r->shrec.edge.CurvedEdgeRecord.NumBits);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
leaq 0x4aad(%rip), %rcx      # 0x9698
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw (%rax), %cx
andw $0x1, %dx
shlw $0x8, %dx
andw $0xfeff, %cx            # imm = 0xFEFF
orw %dx, %cx
movw %cx, (%rax)
movq -0x18(%rbp), %rax
movw (%rax), %ax
shrw $0x8, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x4f3a
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw 0x14(%rax), %cx
andw $0x1, %dx
andw $-0x2, %cx
orw %dx, %cx
movw %cx, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw 0x14(%rax), %cx
andw $0x1, %dx
shlw %dx
andw $-0x3, %cx
orw %dx, %cx
movw %cx, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw 0x14(%rax), %cx
andw $0x1, %dx
shlw $0x2, %dx
andw $-0x5, %cx
orw %dx, %cx
movw %cx, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw 0x14(%rax), %cx
andw $0x1, %dx
shlw $0x3, %dx
andw $-0x9, %cx
orw %dx, %cx
movw %cx, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw 0x14(%rax), %cx
andw $0x1, %dx
shlw $0x4, %dx
andw $-0x11, %cx
orw %dx, %cx
movw %cx, 0x14(%rax)
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x4daf
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x4daf
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x2, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x4daf
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x3, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x4daf
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x4, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x4daf
movq -0x18(%rbp), %rax
movb 0x14(%rax), %cl
andb $-0x20, %cl
orb $0x0, %cl
movb %cl, 0x14(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x518b
movq -0x18(%rbp), %rax
leaq 0x48ed(%rip), %rcx      # 0x96a7
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movb $0x1, 0x10(%rax)
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x4, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x4e59
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movw %cx, %dx
movw 0x14(%rax), %cx
andw $0x1f, %dx
shlw $0x5, %dx
andw $0xfc1f, %cx            # imm = 0xFC1F
orw %dx, %cx
movw %cx, 0x14(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x5, %ax
andw $0x1f, %ax
movzwl %ax, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x5, %ax
andw $0x1f, %ax
movzwl %ax, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x4e84
movq -0x18(%rbp), %rax
movw 0x14(%rax), %cx
andw $0xfc1f, %cx            # imm = 0xFC1F
orw $0x0, %cx
movw %cx, 0x14(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x3, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x4ebe
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movw (%rax), %ax
andw $0xf, %ax
movzwl %ax, %esi
callq 0x33d0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x20(%rax)
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw $0x2, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x4ef8
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movw (%rax), %ax
andw $0xf, %ax
movzwl %ax, %esi
callq 0x33d0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
shrw %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x4f35
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movw (%rax), %ax
shrw $0x4, %ax
andw $0xf, %ax
movzwl %ax, %esi
callq 0x33d0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x24(%rax)
jmp 0x5184
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x50b2
movq -0x18(%rbp), %rax
leaq 0x4759(%rip), %rcx      # 0x96b9
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movb $0x2, 0x10(%rax)
movq -0x18(%rbp), %rax
movb 0x14(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x33d0
movl %eax, %ecx
addl $0x2, %ecx
movq -0x18(%rbp), %rax
movb %cl, %dl
movb 0x14(%rax), %cl
andb $0x1f, %dl
shlb %dl
andb $-0x3f, %cl
orb %dl, %cl
movb %cl, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movb %cl, %dl
movb 0x14(%rax), %cl
andb $0x1, %dl
shlb $0x6, %dl
andb $-0x41, %cl
orb %dl, %cl
movb %cl, 0x14(%rax)
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb $0x6, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5007
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x33d0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movb %cl, %dl
movb 0x14(%rax), %cl
andb $0x1, %dl
shlb $0x7, %dl
andb $0x7f, %cl
orb %dl, %cl
movb %cl, 0x14(%rax)
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb $0x6, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x502d
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb $0x7, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x504f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb %al
andb $0x1f, %al
movzbl %al, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0x505a
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb $0x6, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5080
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb $0x7, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x50a2
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb %al
andb $0x1f, %al
movzbl %al, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x50ad
movq -0x18(%rbp), %rax
movl $0x0, 0x1c(%rax)
jmp 0x5182
movq -0x18(%rbp), %rax
leaq 0x460f(%rip), %rcx      # 0x96cc
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movb $0x3, 0x10(%rax)
movq -0x18(%rbp), %rax
movb 0x14(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x14(%rax)
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x33d0
movl %eax, %ecx
addl $0x2, %ecx
movq -0x18(%rbp), %rax
movb %cl, %dl
movb 0x14(%rax), %cl
andb $0x1f, %dl
shlb %dl
andb $-0x3f, %cl
orb %dl, %cl
movb %cl, 0x14(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb %al
andb $0x1f, %al
movzbl %al, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb %al
andb $0x1f, %al
movzbl %al, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb %al
andb $0x1f, %al
movzbl %al, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x14(%rax), %al
shrb %al
andb $0x1f, %al
movzbl %al, %esi
callq 0x34b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x5184
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)