#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 */
typedef int useconds_t;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ _IONBF;
int atoi(char *);
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int c;
  useconds_t stime = 10000;
  if (argc > 1) {
    stime = 1000000 / atoi(argv[1]);
  }
  setvbuf(stdout, NULL, _IONBF, 0);
  while ((c = fgetc(stdin)) != EOF) {
    fputc(c, stdout);
    usleep(stime);
  }
  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   $0x2710,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1191 <main+0x41>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    $0xf4240,%eax
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    0x2e37(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e1a(%rip),%rcx
cmp    (%rcx),%eax
je     11ec <main+0x9c>
mov    -0x14(%rbp),%edi
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%edi
call   1070 <usleep@plt>
jmp    11ae <main+0x5e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x2710,%ebx
cmp    $0x2,%edi
jl     1178 <main+0x28>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    $0xf4240,%eax
xor    %edx,%edx
idiv   %ecx
mov    %eax,%ebx
mov    0x2e49(%rip),%r14
mov    (%r14),%edi
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    0x2e4d(%rip),%r15
mov    (%r15),%edi
call   1030 <fgetc@plt>
mov    0x2e36(%rip),%r12
cmp    (%r12),%eax
je     11cf <main+0x7f>
mov    (%r14),%esi
mov    %eax,%edi
call   1040 <fputc@plt>
mov    %ebx,%edi
call   1070 <usleep@plt>
mov    (%r15),%edi
call   1030 <fgetc@plt>
cmp    (%r12),%eax
jne    11b0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@stdin = global i32 0
@EOF = global i32 0
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 10000, i32* %7
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
%15 = sdiv i32 1000000, %14
store i32 %15, i32* %7
br label %16
16: ; preds = %10, %2
%17 = load i32, i32* @stdout
%18 = load i32, i32* @_IONBF
%19 = call i32 @setvbuf(i32 %17, i32* null, i32 %18, i32 0)
br label %20
20: ; preds = %25, %16
%21 = load i32, i32* @stdin
%22 = call i32 @fgetc(i32 %21)
store i32 %22, i32* %6
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %31
25: ; preds = %20
%26 = load i32, i32* %6
%27 = load i32, i32* @stdout
%28 = call i32 @fputc(i32 %26, i32 %27)
%29 = load i32, i32* %7
%30 = call i32 @usleep(i32 %29)
br label %20
31: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
@stdin = global i32 0
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = sdiv i32 1000000, %7
br label %9
9: ; preds = %4, %2
%10 = phi i32 [ %8, %4 ], [ 10000, %2 ]
%11 = load i32, i32* @stdout
%12 = load i32, i32* @_IONBF
%13 = tail call i32 @setvbuf(i32 %11, i32* null, i32 %12, i32 0)
%14 = load i32, i32* @stdin
%15 = tail call i32 @fgetc(i32 %14)
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %27, label %18
18: ; preds = %9, %18
%19 = phi i32 [ %24, %18 ], [ %15, %9 ]
%20 = load i32, i32* @stdout
%21 = tail call i32 @fputc(i32 %19, i32 %20)
%22 = tail call i32 @usleep(i32 %10)
%23 = load i32, i32* @stdin
%24 = tail call i32 @fgetc(i32 %23)
%25 = load i32, i32* @EOF
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %18
27: ; preds = %18, %9
ret i32 0
}