#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 */

/* Variables and functions */
int /*<<< orphan*/ ToneA();
int /*<<< orphan*/ ToneC();
int /*<<< orphan*/ ToneE();
void Melody2() {
  unsigned short i;
  for (i = 9; i > 0; i--) {
    ToneA();
    ToneC();
    ToneE();
  }
}


x86 assembly (clang, -O0):
<Melody2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x9,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x0,%eax
jle    1171 <Melody2+0x41>
mov    $0x0,%al
call   1030 <ToneA@plt>
mov    $0x0,%al
call   1050 <ToneC@plt>
mov    $0x0,%al
call   1040 <ToneE@plt>
mov    -0x2(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x2(%rbp)
jmp    113e <Melody2+0xe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Melody2>:
push   %rax
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
call   1040 <ToneE@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1050 <ToneC@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ToneE@plt>

LLVM IR (-O0):
define void @Melody2() {
%1 = alloca i16
store i16 9, i16* %1
br label %2
2: ; preds = %10, %0
%3 = load i16, i16* %1
%4 = zext i16 %3 to i32
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = call i32 (...) @ToneA()
%8 = call i32 (...) @ToneC()
%9 = call i32 (...) @ToneE()
br label %10
10: ; preds = %6
%11 = load i16, i16* %1
%12 = add i16 %11, -1
store i16 %12, i16* %1
br label %2
13: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @Melody2() {
%1 = tail call i32 (...) @ToneA()
%2 = tail call i32 (...) @ToneC()
%3 = tail call i32 (...) @ToneE()
%4 = tail call i32 (...) @ToneA()
%5 = tail call i32 (...) @ToneC()
%6 = tail call i32 (...) @ToneE()
%7 = tail call i32 (...) @ToneA()
%8 = tail call i32 (...) @ToneC()
%9 = tail call i32 (...) @ToneE()
%10 = tail call i32 (...) @ToneA()
%11 = tail call i32 (...) @ToneC()
%12 = tail call i32 (...) @ToneE()
%13 = tail call i32 (...) @ToneA()
%14 = tail call i32 (...) @ToneC()
%15 = tail call i32 (...) @ToneE()
%16 = tail call i32 (...) @ToneA()
%17 = tail call i32 (...) @ToneC()
%18 = tail call i32 (...) @ToneE()
%19 = tail call i32 (...) @ToneA()
%20 = tail call i32 (...) @ToneC()
%21 = tail call i32 (...) @ToneE()
%22 = tail call i32 (...) @ToneA()
%23 = tail call i32 (...) @ToneC()
%24 = tail call i32 (...) @ToneE()
%25 = tail call i32 (...) @ToneA()
%26 = tail call i32 (...) @ToneC()
%27 = tail call i32 (...) @ToneE()
ret void
}