#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;
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ _IONBF;
int atoi(char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, 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) {
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  int c;
  useconds_t stime = 10000;
  if (argc > 1) {
    stime = 1000000 / atoi(argv[1]);
  }
  setvbuf(stdout, NULL, _IONBF, 0);
  while ((read = getline(&line, &len, stdin)) != -1) {
    fputs(line, stdout);
    usleep(stime);
  }
  free(line);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x2710,-0x2c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11b1 <main+0x51>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    $0xf4240,%eax
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    0x2e1f(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <getline@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     120f <main+0xaf>
mov    -0x18(%rbp),%rdi
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
mov    -0x2c(%rbp),%edi
call   1080 <usleep@plt>
jmp    11ce <main+0x6e>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    $0x2710,%ebx
cmp    $0x2,%edi
jl     119e <main+0x3e>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    $0xf4240,%eax
xor    %edx,%edx
idiv   %ecx
mov    %eax,%ebx
mov    0x2e2b(%rip),%r12
mov    (%r12),%edi
mov    0x2e30(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    0x2e26(%rip),%r13
mov    0x0(%r13),%edx
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     1208 <main+0xa8>
mov    %rsp,%r14
lea    0x8(%rsp),%r15
mov    (%rsp),%rdi
mov    (%r12),%esi
call   1040 <fputs@plt>
mov    %ebx,%edi
call   1080 <usleep@plt>
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
jne    11e0 <main+0x80>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i64 0, i64* %7
store i32 10000, i32* %10
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
%18 = sdiv i32 1000000, %17
store i32 %18, i32* %10
br label %19
19: ; preds = %13, %2
%20 = load i32, i32* @stdout
%21 = load i32, i32* @_IONBF
%22 = call i32 @setvbuf(i32 %20, i32* null, i32 %21, i32 0)
br label %23
23: ; preds = %27, %19
%24 = load i32, i32* @stdin
%25 = call i32 @getline(i8** %6, i64* %7, i32 %24)
store i32 %25, i32* %8
%26 = icmp ne i32 %25, -1
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i8*, i8** %6
%29 = load i32, i32* @stdout
%30 = call i32 @fputs(i8* %28, i32 %29)
%31 = load i32, i32* %10
%32 = call i32 @usleep(i32 %31)
br label %23
33: ; preds = %23
%34 = load i8*, i8** %6
%35 = call i32 @free(i8* %34)
ret i32 0
}

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