#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ wav_store_word(int, int /*<<< orphan*/ *);
void wav_write_one(FILE *f) {
  unsigned int l;
  for (l = 0; l < 5 * 2; l++)
    wav_store_word(0x8000, f);
  for (l = 0; l < 5 * 2; l++)
    wav_store_word(0x7FFF, f);
  for (l = 0; l < 5 * 2; l++)
    wav_store_word(0x8000, f);
  for (l = 0; l < 5 * 2; l++)
    wav_store_word(0x7FFF, f);
}


x86 assembly (clang, -O0):
<wav_write_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jae    1149 <wav_write_one+0x39>
mov    -0x8(%rbp),%rsi
mov    $0x8000,%edi
call   1030 <wav_store_word@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <wav_write_one+0x13>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jae    1176 <wav_write_one+0x66>
mov    -0x8(%rbp),%rsi
mov    $0x7fff,%edi
call   1030 <wav_store_word@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <wav_write_one+0x40>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jae    11a3 <wav_write_one+0x93>
mov    -0x8(%rbp),%rsi
mov    $0x8000,%edi
call   1030 <wav_store_word@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <wav_write_one+0x6d>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jae    11d0 <wav_write_one+0xc0>
mov    -0x8(%rbp),%rsi
mov    $0x7fff,%edi
call   1030 <wav_store_word@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11aa <wav_write_one+0x9a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wav_write_one>:
push   %rbx
mov    %rdi,%rbx
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x8000,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
call   1030 <wav_store_word@plt>
mov    $0x7fff,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <wav_store_word@plt>

LLVM IR (-O0):
define void @wav_write_one(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 10
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32*, i32** %2
%9 = call i32 @wav_store_word(i32 32768, i32* %8)
br label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
store i32 0, i32* %3
br label %14
14: ; preds = %20, %13
%15 = load i32, i32* %3
%16 = icmp ult i32 %15, 10
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32*, i32** %2
%19 = call i32 @wav_store_word(i32 32767, i32* %18)
br label %20
20: ; preds = %17
%21 = load i32, i32* %3
%22 = add i32 %21, 1
store i32 %22, i32* %3
br label %14
23: ; preds = %14
store i32 0, i32* %3
br label %24
24: ; preds = %30, %23
%25 = load i32, i32* %3
%26 = icmp ult i32 %25, 10
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i32*, i32** %2
%29 = call i32 @wav_store_word(i32 32768, i32* %28)
br label %30
30: ; preds = %27
%31 = load i32, i32* %3
%32 = add i32 %31, 1
store i32 %32, i32* %3
br label %24
33: ; preds = %24
store i32 0, i32* %3
br label %34
34: ; preds = %40, %33
%35 = load i32, i32* %3
%36 = icmp ult i32 %35, 10
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = load i32*, i32** %2
%39 = call i32 @wav_store_word(i32 32767, i32* %38)
br label %40
40: ; preds = %37
%41 = load i32, i32* %3
%42 = add i32 %41, 1
store i32 %42, i32* %3
br label %34
43: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @wav_write_one(i32* %0) {
%2 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%3 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%4 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%5 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%6 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%7 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%8 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%9 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%10 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%11 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%12 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%13 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%14 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%15 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%16 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%17 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%18 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%19 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%20 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%21 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%22 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%23 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%24 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%25 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%26 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%27 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%28 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%29 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%30 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%31 = tail call i32 @wav_store_word(i32 32768, i32* %0)
%32 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%33 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%34 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%35 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%36 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%37 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%38 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%39 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%40 = tail call i32 @wav_store_word(i32 32767, i32* %0)
%41 = tail call i32 @wav_store_word(i32 32767, i32* %0)
ret void
}