// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, 0x59(%rdi)
andq $0x0, 0x10(%rsi)
pushq $0x4
popq %rsi
callq 0x2694
testl %eax, %eax
jne 0x2fc3
pushq $0x2
popq %r12
movq %r14, %rdi
movl %r12d, %esi
callq 0x2694
movl (%rbx), %ecx
andl $-0x4, %ecx
andl $0x3, %eax
orl %eax, %ecx
movw %cx, (%rbx)
leaq 0x2ece(%rip), %r13      # 0x5d48
movzwl (%r13,%rax,2), %eax
movw %ax, 0x2(%rbx)
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x2694
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 %r15d, %esi
callq 0x2694
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)
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x2694
andl $0xf, %eax
movl %eax, %ecx
shll $0x8, %ecx
movl $0xfffff0ff, %edx       # imm = 0xFFFFF0FF
andl (%rbx), %edx
orl %ecx, %edx
movw %dx, (%rbx)
leaq 0x61fb(%rip), %rcx      # 0x90f0
movq (%rcx,%rax,8), %rax
movq %rax, 0x10(%rbx)
movq %r14, %rdi
movl %r12d, %esi
callq 0x2694
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 (%r13,%rax,2), %eax
movw %ax, 0x6(%rbx)
movq %r14, %rdi
movl %r15d, %esi
callq 0x2694
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 %r15d, %esi
callq 0x2694
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)
movq %r14, %rdi
callq 0x27a3
movw %ax, 0xa(%rbx)
movzwl (%rbx), %eax
movl %eax, %ecx
andl $0xf00, %ecx            # imm = 0xF00
cmpw $0x200, %cx             # imm = 0x200
jne 0x2fa4
orl $0x10, %eax
movw %ax, (%rbx)
movq %r14, %rdi
callq 0x27a3
jmp 0x2fae
andl $0xffef, %eax           # imm = 0xFFEF
movw %ax, (%rbx)
xorl %eax, %eax
movw %ax, 0xc(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x602e(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x3388(%rip), %rdi      # 0x635c
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
callq 0x11a0
jmp 0x2e57