// File: /workspace/github_c_makefile_star2_O1/joncampbell123[P]swfhax/swf.c
// Function: swf_reader_read_SoundStreamHead
int swf_reader_read_SoundStreamHead(swf_reader *swf,swf_SoundStreamHead *h) {
	unsigned int Reserved;

	swf_reader_read_bytealign(swf);
	h->StreamSoundCompression_str = NULL;
	Reserved = swf_reader_read_UB(swf,4);
	if (Reserved != 0) fprintf(stderr,"SWF SoundStreamHead reserved field nonzero\n");
	h->PlaybackSoundRate = swf_reader_read_UB(swf,2);
	h->PlaybackSoundRate_value = swf_SoundRatesUB2[h->PlaybackSoundRate];
	h->PlaybackSoundSize = swf_reader_read_UB(swf,1);
	h->PlaybackSoundSize_value = h->PlaybackSoundSize ? 16 : 8;
	h->PlaybackSoundType = swf_reader_read_UB(swf,1);
	h->PlaybackSoundType_value = h->PlaybackSoundType ? 2 : 1;
	h->StreamSoundCompression = swf_reader_read_UB(swf,4);
	h->StreamSoundCompression_str = swf_SoundCompressionUB4[h->StreamSoundCompression];
	h->StreamSoundRate = swf_reader_read_UB(swf,2);
	h->StreamSoundRate_value = swf_SoundRatesUB2[h->StreamSoundRate];
	h->StreamSoundSize = swf_reader_read_UB(swf,1);
	h->StreamSoundSize_value = h->StreamSoundSize ? 16 : 8;
	h->StreamSoundType = swf_reader_read_UB(swf,1);
	h->StreamSoundType_value = h->StreamSoundType ? 2 : 1;
	h->StreamSoundSampleCount = swf_reader_read_UI16(swf);
	if (h->StreamSoundCompression == 2) {
		h->LatencySeek_present = 1;
		h->LatencySeek = swf_reader_read_UI16(swf);
	}
	else {
		h->LatencySeek_present = 0;
		h->LatencySeek = 0;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, 0x59(%rdi)
movq $0x0, 0x10(%rsi)
movl $0x4, %esi
callq 0x2c8b
testl %eax, %eax
jne 0x3708
movq %r14, %rdi
movl $0x2, %esi
callq 0x2c8b
movl (%rbx), %ecx
andl $-0x4, %ecx
andl $0x3, %eax
orl %eax, %ecx
movw %cx, (%rbx)
leaq 0x37c2(%rip), %r15      # 0x6d48
movzwl (%r15,%rax,2), %eax
movw %ax, 0x2(%rbx)
movq %r14, %rdi
movl $0x1, %esi
callq 0x2c8b
movl (%rbx), %ecx
movl %eax, %edx
andl $0x1, %edx
andl $-0x5, %ecx
leal (%rcx,%rdx,4), %ecx
movw %cx, (%rbx)
andb $0x1, %al
shlb $0x3, %al
addb $0x8, %al
movb %al, 0x4(%rbx)
movq %r14, %rdi
movl $0x1, %esi
callq 0x2c8b
movl (%rbx), %ecx
movl %eax, %edx
andl $0x1, %edx
andl $-0x9, %ecx
leal (%rcx,%rdx,8), %ecx
movw %cx, (%rbx)
andb $0x1, %al
incb %al
movb %al, 0x5(%rbx)
movq %r14, %rdi
movl $0x4, %esi
callq 0x2c8b
andl $0xf, %eax
movl %eax, %ecx
shll $0x8, %ecx
movl $0xfffff0ff, %edx       # imm = 0xFFFFF0FF
andl (%rbx), %edx
orl %ecx, %edx
movw %dx, (%rbx)
leaq 0x6ade(%rip), %rcx      # 0xa0e0
movq (%rcx,%rax,8), %rax
movq %rax, 0x10(%rbx)
movq %r14, %rdi
movl $0x2, %esi
callq 0x2c8b
movl (%rbx), %ecx
movl %eax, %edx
shll $0x5, %edx
andl $0x60, %edx
andl $-0x61, %ecx
orl %edx, %ecx
movw %cx, (%rbx)
andl $0x3, %eax
movzwl (%r15,%rax,2), %eax
movw %ax, 0x6(%rbx)
movq %r14, %rdi
movl $0x1, %esi
callq 0x2c8b
movl %eax, %ecx
shll $0x7, %ecx
movzbl %cl, %ecx
movl $0xffffff7f, %edx       # imm = 0xFFFFFF7F
andl (%rbx), %edx
orl %ecx, %edx
movw %dx, (%rbx)
andb $0x1, %al
shlb $0x3, %al
addb $0x8, %al
movb %al, 0x8(%rbx)
movq %r14, %rdi
movl $0x1, %esi
callq 0x2c8b
movl %eax, %ecx
andl $0x1, %ecx
shll $0xc, %ecx
movl $0xffffefff, %edx       # imm = 0xFFFFEFFF
andl (%rbx), %edx
orl %ecx, %edx
movw %dx, (%rbx)
andb $0x1, %al
incb %al
movb %al, 0x9(%rbx)
leaq -0x1a(%rbp), %r15
movw $0x0, (%r15)
movb $0x0, 0x59(%r14)
movq %r14, %rdi
movq %r15, %rsi
movl $0x2, %edx
callq 0x2a4f
movzwl (%r15), %eax
movw %ax, 0xa(%rbx)
movzwl (%rbx), %eax
movl %eax, %ecx
andl $0xf00, %ecx            # imm = 0xF00
cmpl $0x200, %ecx            # imm = 0x200
jne 0x36ed
orl $0x10, %eax
movw %ax, (%rbx)
leaq -0x1c(%rbp), %r15
movw $0x0, (%r15)
movb $0x0, 0x59(%r14)
movq %r14, %rdi
movq %r15, %rsi
movl $0x2, %edx
callq 0x2a4f
movzwl (%r15), %eax
jmp 0x36f7
andl $0xffef, %eax           # imm = 0xFFEF
movw %ax, (%rbx)
xorl %eax, %eax
movw %ax, 0xc(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x13ce
jmp 0x3565