#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 atoi(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ test(int, int);
int main(int argc, char **argv) {
  int i, len;
  if (argc > 1) {
    len = atoi(argv[1]);
    for (i = 0; i < 1; i++)
      test(len, 1000000);
    return 0;
  }
  for (;;) {
    for (i = 1; i <= 20; ++i) {
      test(i, 1000);
    }
    printf(".");
    fflush(stdout);
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jle    11a4 <main+0x64>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    119c <main+0x5c>
mov    -0x18(%rbp),%edi
mov    $0xf4240,%esi
call   1060 <test@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x37>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    11a9 <main+0x69>
movl   $0x1,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jg     11d5 <main+0x95>
mov    -0x14(%rbp),%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0x70>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    11a9 <main+0x69>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    115f <main+0x1f>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
mov    $0xf4240,%esi
call   1060 <test@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e7a(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x2,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x3,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x4,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x5,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x6,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x7,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x8,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x9,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0xa,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0xb,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0xc,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0xd,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0xe,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0xf,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x10,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x11,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x12,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x13,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x14,%edi
mov    $0x3e8,%esi
call   1060 <test@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@stdout = 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
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %25
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)
store i32 %14, i32* %7
store i32 0, i32* %6
br label %15
15: ; preds = %21, %10
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* %7
%20 = call i32 @test(i32 %19, i32 1000000)
br label %21
21: ; preds = %18
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %15
24: ; preds = %15
ret i32 0
25: ; preds = %2
br label %26
26: ; preds = %36, %25
store i32 1, i32* %6
br label %27
27: ; preds = %33, %26
%28 = load i32, i32* %6
%29 = icmp sle i32 %28, 20
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load i32, i32* %6
%32 = call i32 @test(i32 %31, i32 1000)
br label %33
33: ; preds = %30
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %27
36: ; preds = %27
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%38 = load i32, i32* @stdout
%39 = call i32 @fflush(i32 %38)
br label %26
}

LLVM IR (-O2):
@stdout = 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 = tail call i32 @test(i32 %7, i32 1000000)
ret i32 0
9: ; preds = %2, %9
%10 = tail call i32 @test(i32 1, i32 1000)
%11 = tail call i32 @test(i32 2, i32 1000)
%12 = tail call i32 @test(i32 3, i32 1000)
%13 = tail call i32 @test(i32 4, i32 1000)
%14 = tail call i32 @test(i32 5, i32 1000)
%15 = tail call i32 @test(i32 6, i32 1000)
%16 = tail call i32 @test(i32 7, i32 1000)
%17 = tail call i32 @test(i32 8, i32 1000)
%18 = tail call i32 @test(i32 9, i32 1000)
%19 = tail call i32 @test(i32 10, i32 1000)
%20 = tail call i32 @test(i32 11, i32 1000)
%21 = tail call i32 @test(i32 12, i32 1000)
%22 = tail call i32 @test(i32 13, i32 1000)
%23 = tail call i32 @test(i32 14, i32 1000)
%24 = tail call i32 @test(i32 15, i32 1000)
%25 = tail call i32 @test(i32 16, i32 1000)
%26 = tail call i32 @test(i32 17, i32 1000)
%27 = tail call i32 @test(i32 18, i32 1000)
%28 = tail call i32 @test(i32 19, i32 1000)
%29 = tail call i32 @test(i32 20, i32 1000)
%30 = tail call i32 @putchar(i32 46)
%31 = load i32, i32* @stdout
%32 = tail call i32 @fflush(i32 %31)
br label %9
}