#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 /*<<< orphan*/);
void S_surprise() {
  for (int i = 800; i < 2000; i = i * 1.02) {
    ZowiTone(10, i, 18, 0);
  }
  for (int i = 2000; i > 800; i = i / 1.02) {
    ZowiTone(10, i, 13, 0);
  }
}


x86 assembly (clang, -O0):
<S_surprise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x320,-0x4(%rbp)
cmpl   $0x7d0,-0x4(%rbp)
jge    115d <S_surprise+0x4d>
mov    -0x4(%rbp),%esi
mov    $0xa,%edi
mov    $0x12,%edx
xor    %ecx,%ecx
call   1030 <ZowiTone@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeb3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <S_surprise+0xf>
movl   $0x7d0,-0x8(%rbp)
cmpl   $0x320,-0x8(%rbp)
jle    11a2 <S_surprise+0x92>
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
mov    $0xd,%edx
xor    %ecx,%ecx
call   1030 <ZowiTone@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <S_surprise+0x54>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_surprise>:
push   %rbx
mov    $0x320,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0x12,%edx
xor    %ecx,%ecx
call   1030 <ZowiTone@plt>
movsd  0xec5(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebx
cmp    $0x7d0,%ebx
jl     1120 <S_surprise+0x10>
mov    $0x7d0,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %ebx,%esi
mov    $0xd,%edx
xor    %ecx,%ecx
call   1030 <ZowiTone@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0xe7e(%rip),%xmm0
cvttsd2si %xmm0,%ebx
cmp    $0x320,%ebx
jg     1160 <S_surprise+0x50>
pop    %rbx
ret

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

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