#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*/ execSysCall(int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void playTest() {
  int i;
  printf("Playing sound\n");
  for (i = 1; i < 30; i++) {
    execSysCall(0x0C80, 500, 440 + 10 * i, 0);
  }
  for (i = 1; i < 15; i++) {
    execSysCall(0x0C80, 500, 590 - 10 * i, 0);
  }
}


x86 assembly (clang, -O0):
<playTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jge    116e <playTest+0x4e>
imul   $0xa,-0x4(%rbp),%edx
add    $0x1b8,%edx
mov    $0xc80,%edi
mov    $0x1f4,%esi
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113b <playTest+0x1b>
movl   $0x1,-0x4(%rbp)
cmpl   $0xf,-0x4(%rbp)
jge    11a9 <playTest+0x89>
imul   $0xa,-0x4(%rbp),%eax
mov    $0x24e,%edx
sub    %eax,%edx
mov    $0xc80,%edi
mov    $0x1f4,%esi
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1175 <playTest+0x55>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<playTest>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1c2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
add    $0xa,%ebx
cmp    $0x2e4,%ebx
jne    1140 <playTest+0x20>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x244,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x23a,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x230,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x226,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x21c,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x212,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x208,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1fe,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1f4,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1ea,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1e0,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1d6,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1cc,%edx
xor    %ecx,%ecx
call   1040 <execSysCall@plt>
mov    $0xc80,%edi
mov    $0x1f4,%esi
mov    $0x1c2,%edx
xor    %ecx,%ecx
pop    %rbx
jmp    1040 <execSysCall@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Playing sound\0A\00"
define void @playTest() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 30
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load i32, i32* %1
%8 = mul nsw i32 10, %7
%9 = add nsw i32 440, %8
%10 = call i32 @execSysCall(i32 3200, i32 500, i32 %9, i32 0)
br label %11
11: ; preds = %6
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %3
14: ; preds = %3
store i32 1, i32* %1
br label %15
15: ; preds = %23, %14
%16 = load i32, i32* %1
%17 = icmp slt i32 %16, 15
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* %1
%20 = mul nsw i32 10, %19
%21 = sub nsw i32 590, %20
%22 = call i32 @execSysCall(i32 3200, i32 500, i32 %21, i32 0)
br label %23
23: ; preds = %18
%24 = load i32, i32* %1
%25 = add nsw i32 %24, 1
store i32 %25, i32* %1
br label %15
26: ; preds = %15
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Playing sound\00"
define void @playTest() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 1, %0 ], [ %7, %2 ]
%4 = mul nuw nsw i32 %3, 10
%5 = add nuw nsw i32 %4, 440
%6 = tail call i32 @execSysCall(i32 3200, i32 500, i32 %5, i32 0)
%7 = add nuw nsw i32 %3, 1
%8 = icmp eq i32 %7, 30
br i1 %8, label %9, label %2
9: ; preds = %2
%10 = tail call i32 @execSysCall(i32 3200, i32 500, i32 580, i32 0)
%11 = tail call i32 @execSysCall(i32 3200, i32 500, i32 570, i32 0)
%12 = tail call i32 @execSysCall(i32 3200, i32 500, i32 560, i32 0)
%13 = tail call i32 @execSysCall(i32 3200, i32 500, i32 550, i32 0)
%14 = tail call i32 @execSysCall(i32 3200, i32 500, i32 540, i32 0)
%15 = tail call i32 @execSysCall(i32 3200, i32 500, i32 530, i32 0)
%16 = tail call i32 @execSysCall(i32 3200, i32 500, i32 520, i32 0)
%17 = tail call i32 @execSysCall(i32 3200, i32 500, i32 510, i32 0)
%18 = tail call i32 @execSysCall(i32 3200, i32 500, i32 500, i32 0)
%19 = tail call i32 @execSysCall(i32 3200, i32 500, i32 490, i32 0)
%20 = tail call i32 @execSysCall(i32 3200, i32 500, i32 480, i32 0)
%21 = tail call i32 @execSysCall(i32 3200, i32 500, i32 470, i32 0)
%22 = tail call i32 @execSysCall(i32 3200, i32 500, i32 460, i32 0)
%23 = tail call i32 @execSysCall(i32 3200, i32 500, i32 450, i32 0)
ret void
}