#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*/ WriteFSK(int);
void Test() {
  for (int j = 0; j < 1000; j++) {
    for (int i = 0; i < 500; i++)
      WriteFSK(1);
    for (int i = 0; i < 500; i++)
      WriteFSK(0);
  }
}


x86 assembly (clang, -O0):
<Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    1194 <Test+0x84>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jge    1158 <Test+0x48>
mov    $0x1,%edi
call   1030 <WriteFSK@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <Test+0x23>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1f4,-0xc(%rbp)
jge    1181 <Test+0x71>
xor    %edi,%edi
call   1030 <WriteFSK@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <Test+0x4f>
jmp    1186 <Test+0x76>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <Test+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1f4,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
call   1030 <WriteFSK@plt>
add    $0xffffffff,%ebp
jne    1130 <Test+0x20>
mov    $0x1f4,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
call   1030 <WriteFSK@plt>
add    $0xffffffff,%ebp
jne    1150 <Test+0x40>
add    $0x1,%ebx
cmp    $0x3e8,%ebx
jne    1120 <Test+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @Test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %26, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %29
7: ; preds = %4
store i32 0, i32* %2
br label %8
8: ; preds = %13, %7
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 500
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = call i32 @WriteFSK(i32 1)
br label %13
13: ; preds = %11
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %8
16: ; preds = %8
store i32 0, i32* %3
br label %17
17: ; preds = %22, %16
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 500
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = call i32 @WriteFSK(i32 0)
br label %22
22: ; preds = %20
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %17
25: ; preds = %17
br label %26
26: ; preds = %25
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
store i32 %28, i32* %1
br label %4
29: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @Test() {
br label %1
1: ; preds = %0, %9
%2 = phi i32 [ 0, %0 ], [ %10, %9 ]
br label %4
3: ; preds = %9
ret void
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %7, %4 ]
%6 = tail call i32 @WriteFSK(i32 1)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 500
br i1 %8, label %12, label %4
9: ; preds = %12
%10 = add nuw nsw i32 %2, 1
%11 = icmp eq i32 %10, 1000
br i1 %11, label %3, label %1
12: ; preds = %4, %12
%13 = phi i32 [ %15, %12 ], [ 0, %4 ]
%14 = tail call i32 @WriteFSK(i32 0)
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, 500
br i1 %16, label %9, label %12
}