#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*/ ZowiTone(int, int, int, int);
int /*<<< orphan*/ delay(int);
void S_superHappy() {
  for (int i = 2000; i < 6000; i = i * 1.05) {
    ZowiTone(10, i, 8, 2);
  }
  delay(50);
  for (int i = 6000; i > 2000; i = i / 1.05) {
    ZowiTone(10, i, 15, 2);
  }
}


x86 assembly (clang, -O0):
<S_superHappy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7d0,-0x4(%rbp)
cmpl   $0x1770,-0x4(%rbp)
jge    1170 <S_superHappy+0x50>
mov    -0x4(%rbp),%esi
mov    $0xa,%edi
mov    $0x8,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <S_superHappy+0xf>
mov    $0x32,%edi
call   1040 <delay@plt>
movl   $0x1770,-0x8(%rbp)
cmpl   $0x7d0,-0x8(%rbp)
jle    11c2 <S_superHappy+0xa2>
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
mov    $0xf,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe4e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
jmp    1181 <S_superHappy+0x61>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_superHappy>:
push   %rbx
mov    $0x7d0,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0x8,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xeab(%rip),%xmm0
cvttsd2si %xmm0,%ebx
cmp    $0x1770,%ebx
jl     1130 <S_superHappy+0x10>
mov    $0x32,%edi
call   1040 <delay@plt>
mov    $0x1770,%ebx
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0xf,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0xe6b(%rip),%xmm0
cvttsd2si %xmm0,%ebx
cmp    $0x7d0,%ebx
jg     1170 <S_superHappy+0x50>
pop    %rbx
ret

LLVM IR (-O0):
define void @S_superHappy() {
%1 = alloca i32
%2 = alloca i32
store i32 2000, i32* %1
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 6000
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @ZowiTone(i32 10, i32 %7, i32 8, i32 2)
br label %9
9: ; preds = %6
%10 = load i32, i32* %1
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 1.050000e+00
%13 = fptosi double %12 to i32
store i32 %13, i32* %1
br label %3
14: ; preds = %3
%15 = call i32 @delay(i32 50)
store i32 6000, i32* %2
br label %16
16: ; preds = %22, %14
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 2000
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %2
%21 = call i32 @ZowiTone(i32 10, i32 %20, i32 15, i32 2)
br label %22
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sitofp i32 %23 to double
%25 = fdiv double %24, 1.050000e+00
%26 = fptosi double %25 to i32
store i32 %26, i32* %2
br label %16
27: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @S_superHappy() {
br label %3
1: ; preds = %3
%2 = tail call i32 @delay(i32 50)
br label %11
3: ; preds = %0, %3
%4 = phi i32 [ 2000, %0 ], [ %8, %3 ]
%5 = tail call i32 @ZowiTone(i32 10, i32 %4, i32 8, i32 2)
%6 = sitofp i32 %4 to double
%7 = fmul double %6, 1.050000e+00
%8 = fptosi double %7 to i32
%9 = icmp slt i32 %8, 6000
br i1 %9, label %3, label %1
10: ; preds = %11
ret void
11: ; preds = %1, %11
%12 = phi i32 [ 6000, %1 ], [ %16, %11 ]
%13 = tail call i32 @ZowiTone(i32 10, i32 %12, i32 15, i32 2)
%14 = sitofp i32 %12 to double
%15 = fdiv double %14, 1.050000e+00
%16 = fptosi double %15 to i32
%17 = icmp sgt i32 %16, 2000
br i1 %17, label %11, label %10
}