#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 */
scalar_t__ fork();
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i;
  if (fork()) {
    for (i = 0; i++ < 180;) {
      putc('.', stderr);
      if (i % 30 == 0)
        putc('\n', stderr);
      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)
mov    $0x0,%al
call   1050 <fork@plt>
cmp    $0x0,%rax
je     11c2 <main+0x92>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0xb4,%eax
jge    11bd <main+0x8d>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    $0x2e,%edi
call   1030 <putc@plt>
mov    -0x14(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ae <main+0x7e>
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <putc@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    115e <main+0x2e>
jmp    11c2 <main+0x92>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <fork@plt>
test   %rax,%rax
je     11ae <main+0x7e>
mov    $0x1,%r15b
mov    0x2e91(%rip),%r14
jmp    1179 <main+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <sleep@plt>
add    $0xffffffff,%ebx
add    $0x1,%r15b
cmp    $0xffffff4c,%ebx
je     11ae <main+0x7e>
movzbl %r15b,%eax
imul   $0x89,%eax,%eax
shr    $0xc,%eax
imul   $0xffffffe2,%eax,%ebp
mov    (%r14),%esi
mov    $0x2e,%edi
call   1030 <putc@plt>
or     $0x1,%bpl
cmp    %bl,%bpl
jne    1160 <main+0x30>
mov    (%r14),%esi
mov    $0xa,%edi
call   1030 <putc@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 (...) @fork()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %2
store i32 0, i32* %6
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
store i32 %12, i32* %6
%13 = icmp slt i32 %11, 180
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @putc(i8 signext 46, i32 %15)
%17 = load i32, i32* %6
%18 = srem i32 %17, 30
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = load i32, i32* @stderr
%22 = call i32 @putc(i8 signext 10, i32 %21)
br label %23
23: ; preds = %20, %14
%24 = call i32 @sleep(i32 1)
br label %10
25: ; preds = %10
br label %26
26: ; preds = %25, %2
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @fork()
%4 = icmp eq i64 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %2, %15
%6 = phi i32 [ %17, %15 ], [ 1, %2 ]
%7 = load i32, i32* @stderr
%8 = tail call i32 @putc(i8 signext 46, i32 %7)
%9 = trunc i32 %6 to i8
%10 = urem i8 %9, 30
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = load i32, i32* @stderr
%14 = tail call i32 @putc(i8 signext 10, i32 %13)
br label %15
15: ; preds = %12, %5
%16 = tail call i32 @sleep(i32 1)
%17 = add nuw nsw i32 %6, 1
%18 = icmp eq i32 %17, 181
br i1 %18, label %19, label %5
19: ; preds = %15, %2
ret i32 0
}