#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);
void S_confused() {
  for (int i = 1000; i < 1700; i = i * 1.02) {
    ZowiTone(10, i, 8, 2);
  }
  for (int i = 1700; i > 500; i = i / 1.02) {
    ZowiTone(10, i, 8, 2);
  }
  for (int i = 1000; i < 1700; i = i * 1.05) {
    ZowiTone(10, i, 8, 10);
  }
}


x86 assembly (clang, -O0):
<S_confused>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3e8,-0x4(%rbp)
cmpl   $0x6a4,-0x4(%rbp)
jge    1160 <S_confused+0x50>
mov    -0x4(%rbp),%esi
mov    $0xa,%edi
mov    $0x8,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <S_confused+0xf>
movl   $0x6a4,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jle    11a8 <S_confused+0x98>
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
mov    $0x8,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe70(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <S_confused+0x57>
movl   $0x3e8,-0xc(%rbp)
cmpl   $0x6a4,-0xc(%rbp)
jge    11ed <S_confused+0xdd>
mov    -0xc(%rbp),%esi
mov    $0xa,%ecx
mov    $0x8,%edx
mov    %ecx,%edi
call   1030 <ZowiTone@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
jmp    11af <S_confused+0x9f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_confused>:
push   %rbx
mov    $0x3e8,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0x8,%edx
mov    $0x2,%ecx
call   1030 <ZowiTone@plt>
movsd  0xec2(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebx
cmp    $0x6a4,%ebx
jl     1120 <S_confused+0x10>
mov    $0x6a4,%ebx
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
divsd  0xe7b(%rip),%xmm0
cvttsd2si %xmm0,%ebx
cmp    $0x1f4,%ebx
jg     1160 <S_confused+0x50>
mov    $0xa,%edi
mov    $0x3e8,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x41a,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x44e,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x485,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x4be,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x4fa,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x539,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x57b,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x5c1,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x60a,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x657,%esi
mov    $0x8,%edx
mov    $0xa,%ecx
pop    %rbx
jmp    1030 <ZowiTone@plt>

LLVM IR (-O0):
define void @S_confused() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1000, i32* %1
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1700
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %1
%9 = call i32 @ZowiTone(i32 10, i32 %8, i32 8, i32 2)
br label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = sitofp i32 %11 to double
%13 = fmul double %12, 1.020000e+00
%14 = fptosi double %13 to i32
store i32 %14, i32* %1
br label %4
15: ; preds = %4
store i32 1700, i32* %2
br label %16
16: ; preds = %22, %15
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 500
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %2
%21 = call i32 @ZowiTone(i32 10, i32 %20, i32 8, i32 2)
br label %22
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sitofp i32 %23 to double
%25 = fdiv double %24, 1.020000e+00
%26 = fptosi double %25 to i32
store i32 %26, i32* %2
br label %16
27: ; preds = %16
store i32 1000, i32* %3
br label %28
28: ; preds = %34, %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 1700
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i32, i32* %3
%33 = call i32 @ZowiTone(i32 10, i32 %32, i32 8, i32 10)
br label %34
34: ; preds = %31
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to double
%37 = fmul double %36, 1.050000e+00
%38 = fptosi double %37 to i32
store i32 %38, i32* %3
br label %28
39: ; preds = %28
ret void
}

LLVM IR (-O2):
define void @S_confused() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1000, %0 ], [ %6, %1 ]
%3 = tail call i32 @ZowiTone(i32 10, i32 %2, i32 8, i32 2)
%4 = sitofp i32 %2 to double
%5 = fmul double %4, 1.020000e+00
%6 = fptosi double %5 to i32
%7 = icmp slt i32 %6, 1700
br i1 %7, label %1, label %8
8: ; preds = %1, %8
%9 = phi i32 [ %13, %8 ], [ 1700, %1 ]
%10 = tail call i32 @ZowiTone(i32 10, i32 %9, i32 8, i32 2)
%11 = sitofp i32 %9 to double
%12 = fdiv double %11, 1.020000e+00
%13 = fptosi double %12 to i32
%14 = icmp sgt i32 %13, 500
br i1 %14, label %8, label %15
15: ; preds = %8
%16 = tail call i32 @ZowiTone(i32 10, i32 1000, i32 8, i32 10)
%17 = tail call i32 @ZowiTone(i32 10, i32 1050, i32 8, i32 10)
%18 = tail call i32 @ZowiTone(i32 10, i32 1102, i32 8, i32 10)
%19 = tail call i32 @ZowiTone(i32 10, i32 1157, i32 8, i32 10)
%20 = tail call i32 @ZowiTone(i32 10, i32 1214, i32 8, i32 10)
%21 = tail call i32 @ZowiTone(i32 10, i32 1274, i32 8, i32 10)
%22 = tail call i32 @ZowiTone(i32 10, i32 1337, i32 8, i32 10)
%23 = tail call i32 @ZowiTone(i32 10, i32 1403, i32 8, i32 10)
%24 = tail call i32 @ZowiTone(i32 10, i32 1473, i32 8, i32 10)
%25 = tail call i32 @ZowiTone(i32 10, i32 1546, i32 8, i32 10)
%26 = tail call i32 @ZowiTone(i32 10, i32 1623, i32 8, i32 10)
ret void
}