#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int iter1, iter2;
  for (iter1 = 0; iter1 < 100; iter1++) {
    printf(".");
    sleep(1);
  }
  for (iter2 = 0; iter2 < 100; iter2++) {
    fprintf(stderr, "x");
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    117b <main+0x4b>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x1d>
movl   $0x0,-0x18(%rbp)
cmpl   $0x64,-0x18(%rbp)
jge    11b9 <main+0x89>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1182 <main+0x52>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x64,%ebx
nopl   0x0(%rax)
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
add    $0xffffffff,%ebx
jne    1140 <main+0x10>
mov    $0x64,%ebp
mov    0x2e7b(%rip),%r14
lea    0xe94(%rip),%rbx
nopl   0x0(%rax)
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
add    $0xffffffff,%ebp
jne    1170 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"x\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %8
8: ; preds = %14, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @sleep(i32 1)
br label %14
14: ; preds = %11
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %6
br label %8
17: ; preds = %8
store i32 0, i32* %7
br label %18
18: ; preds = %25, %17
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 100
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @sleep(i32 1)
br label %25
25: ; preds = %21
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %18
28: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [2 x i8] c"x\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %7, %3 ]
%5 = tail call i32 @putchar(i32 46)
%6 = tail call i32 @sleep(i32 1)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 100
br i1 %8, label %9, label %3
9: ; preds = %3, %9
%10 = phi i32 [ %14, %9 ], [ 0, %3 ]
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @sleep(i32 1)
%14 = add nuw nsw i32 %10, 1
%15 = icmp eq i32 %14, 100
br i1 %15, label %16, label %9
16: ; preds = %9
ret i32 0
}