#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*/ printf(char *, int);
void sequential_generator(void) {
  for (int elements = 100; elements <= 2000; elements += 100) {
    printf("# %d\n", elements);
    for (int i = 1; i <= elements; ++i)
      printf("I %d\n", i);
    for (int j = 0; j < 2; ++j)
      for (int i = 1; i <= elements / 2; ++i)
        printf("F %d\n", i);
  }
}


x86 assembly (clang, -O0):
<sequential_generator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x64,-0x4(%rbp)
cmpl   $0x7d0,-0x4(%rbp)
jg     11e4 <sequential_generator+0xd4>
mov    -0x4(%rbp),%esi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     116b <sequential_generator+0x5b>
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <sequential_generator+0x32>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    11d1 <sequential_generator+0xc1>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jg     11be <sequential_generator+0xae>
mov    -0x10(%rbp),%esi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <sequential_generator+0x73>
jmp    11c3 <sequential_generator+0xb3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <sequential_generator+0x62>
jmp    11d6 <sequential_generator+0xc6>
mov    -0x4(%rbp),%eax
add    $0x64,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <sequential_generator+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequential_generator>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x64,%r15d
mov    $0xffffff9c,%ebp
mov    $0xffffffce,%r14d
lea    0xed3(%rip),%r12
lea    0xed2(%rip),%r13
nopw   0x0(%rax,%rax,1)
lea    0xeb9(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1160 <sequential_generator+0x50>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1190 <sequential_generator+0x80>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    11c0 <sequential_generator+0xb0>
lea    0x64(%r15),%eax
add    $0xffffff9c,%ebp
add    $0xffffffce,%r14d
cmp    $0x76d,%r15d
mov    %eax,%r15d
jb     1140 <sequential_generator+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"# %d\0A\00"
@.str.1 = [6 x i8] c"I %d\0A\00"
@.str.2 = [6 x i8] c"F %d\0A\00"
define void @sequential_generator() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 100, i32* %1
br label %5
5: ; preds = %42, %0
%6 = load i32, i32* %1
%7 = icmp sle i32 %6, 2000
br i1 %7, label %8, label %45
8: ; preds = %5
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 1, i32* %2
br label %11
11: ; preds = %18, %8
%12 = load i32, i32* %2
%13 = load i32, i32* %1
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %11
21: ; preds = %11
store i32 0, i32* %3
br label %22
22: ; preds = %38, %21
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %41
25: ; preds = %22
store i32 1, i32* %4
br label %26
26: ; preds = %34, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %1
%29 = sdiv i32 %28, 2
%30 = icmp sle i32 %27, %29
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i32, i32* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %26
37: ; preds = %26
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %22
41: ; preds = %22
br label %42
42: ; preds = %41
%43 = load i32, i32* %1
%44 = add nsw i32 %43, 100
store i32 %44, i32* %1
br label %5
45: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"# %d\0A\00"
@.str.1 = [6 x i8] c"I %d\0A\00"
@.str.2 = [6 x i8] c"F %d\0A\00"
define void @sequential_generator() {
br label %2
1: ; preds = %17
ret void
2: ; preds = %0, %17
%3 = phi i32 [ 51, %0 ], [ %21, %17 ]
%4 = phi i32 [ 101, %0 ], [ %20, %17 ]
%5 = phi i32 [ 100, %0 ], [ %18, %17 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %2, %7
%8 = phi i32 [ 1, %2 ], [ %10, %7 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %4
br i1 %11, label %22, label %7
12: ; preds = %22, %12
%13 = phi i32 [ %15, %12 ], [ 1, %22 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, %3
br i1 %16, label %17, label %12
17: ; preds = %12
%18 = add nuw nsw i32 %5, 100
%19 = icmp ult i32 %5, 1901
%20 = add nuw nsw i32 %4, 100
%21 = add nuw nsw i32 %3, 50
br i1 %19, label %2, label %1
22: ; preds = %7, %22
%23 = phi i32 [ %25, %22 ], [ 1, %7 ]
%24 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, %3
br i1 %26, label %12, label %22
}