#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int main(int argc, char *argv[]) {
  char buf[1024];
  int dotcount = 10;
  int dots = 0;
  FILE *log_strm = 0;
  int line_end;
  char *err_ptr = 0;
  if (argc > 1 && (strcmp("/dev/null", argv[1]) != 0)) {
    log_strm = fopen(argv[1], "a");
    if (log_strm == 0)
      perror(argv[0]);
  }
  if (argc > 2) {
    int expected_lines = atoi(argv[2]);
    if (expected_lines > 80) {
      dotcount = expected_lines / 80;
    }
  }
  while (fgets(buf, 1024, stdin) != NULL) {
    buf[1023] = '\0';
    if (log_strm)
      fputs(buf, log_strm);
    if ((err_ptr = strstr(buf, "Error"))) {
      line_end = strlen(buf) - 10;
      if (strstr(buf, "make") == buf && (err_ptr - buf) > line_end) {
        if (log_strm)
          fclose(log_strm);
        fprintf(stderr, "error\n");
        exit(1);
      }
    }
    if (dots == 0) {
      putchar('.');
      fflush(stdout);
      dots = dotcount;
    }
    dots--;
  }
  if (log_strm)
    fclose(log_strm);
  printf("done\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x414(%rbp)
movl   $0x0,-0x418(%rbp)
movq   $0x0,-0x420(%rbp)
movq   $0x0,-0x430(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1285 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdc4(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1285 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb0(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x420(%rbp)
cmpq   $0x0,-0x420(%rbp)
jne    1280 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10d0 <perror@plt>
jmp    1285 <main+0xa5>
cmpl   $0x2,-0x8(%rbp)
jle    12c8 <main+0xe8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x434(%rbp)
cmpl   $0x50,-0x434(%rbp)
jle    12c3 <main+0xe3>
mov    -0x434(%rbp),%eax
mov    $0x50,%ecx
cltd
idiv   %ecx
mov    %eax,-0x414(%rbp)
jmp    12c8 <main+0xe8>
jmp    12cd <main+0xed>
lea    -0x410(%rbp),%rdi
mov    0x2d0d(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1416 <main+0x236>
movb   $0x0,-0x11(%rbp)
cmpq   $0x0,-0x420(%rbp)
je     1316 <main+0x136>
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%rsi
call   1070 <fputs@plt>
lea    -0x410(%rbp),%rdi
lea    0xce8(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x430(%rbp)
cmp    $0x0,%rax
je     13d1 <main+0x1f1>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0xa,%eax
mov    %eax,-0x424(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xcb5(%rip),%rsi
call   1100 <strstr@plt>
lea    -0x410(%rbp),%rcx
cmp    %rcx,%rax
jne    13cc <main+0x1ec>
mov    -0x430(%rbp),%rax
lea    -0x410(%rbp),%rcx
sub    %rcx,%rax
movslq -0x424(%rbp),%rcx
cmp    %rcx,%rax
jle    13cc <main+0x1ec>
cmpq   $0x0,-0x420(%rbp)
je     13ad <main+0x1cd>
mov    -0x420(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2c24(%rip),%rax
mov    (%rax),%edi
lea    0xc5a(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    13d1 <main+0x1f1>
cmpl   $0x0,-0x418(%rbp)
jne    1402 <main+0x222>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
mov    -0x414(%rbp),%eax
mov    %eax,-0x418(%rbp)
mov    -0x418(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x418(%rbp)
jmp    12cd <main+0xed>
cmpq   $0x0,-0x420(%rbp)
je     1430 <main+0x250>
mov    -0x420(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xbe7(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    $0xa,%eax
mov    %rax,0x8(%rsp)
cmp    $0x2,%edi
jl     1249 <main+0x59>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rsi
lea    0xde0(%rip),%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1256 <main+0x66>
mov    0x8(%rbx),%rdi
lea    0xdd5(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
je     124e <main+0x5e>
cmp    $0x3,%ebp
jae    125e <main+0x6e>
jmp    1291 <main+0xa1>
xor    %r14d,%r14d
jmp    1291 <main+0xa1>
mov    (%rbx),%rdi
call   10e0 <perror@plt>
xor    %r14d,%r14d
cmp    $0x3,%ebp
jb     1291 <main+0xa1>
mov    0x10(%rbx),%rdi
call   10f0 <atoi@plt>
mov    $0xa,%ecx
mov    %rcx,0x8(%rsp)
cmp    $0x51,%eax
jl     1291 <main+0xa1>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x25,%rcx
add    %eax,%ecx
mov    %rcx,0x8(%rsp)
mov    0x2d50(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    $0x400,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1395 <main+0x1a5>
xor    %r15d,%r15d
lea    0xd53(%rip),%r12
jmp    12fc <main+0x10c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %r15d,%r15d
je     1370 <main+0x180>
add    $0xffffffff,%r15d
mov    0x2d04(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    $0x400,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1395 <main+0x1a5>
movb   $0x0,0x40f(%rsp)
test   %r14,%r14
je     1314 <main+0x124>
mov    %r13,%rdi
mov    %r14,%rsi
call   1080 <fputs@plt>
mov    %r13,%rdi
lea    0xcee(%rip),%rsi
call   1110 <strstr@plt>
test   %rax,%rax
je     12d0 <main+0xe0>
mov    %rax,%rbp
mov    %r13,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    12d0 <main+0xe0>
add    $0xfffffff6,%ebx
sub    %r13,%rbp
movslq %ebx,%rax
cmp    %rax,%rbp
jle    12d0 <main+0xe0>
jmp    13c2 <main+0x1d2>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    0x2c4f(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    0x8(%rsp),%rax
mov    %eax,%r15d
jmp    12d9 <main+0xe9>
test   %r14,%r14
je     13a2 <main+0x1b2>
mov    %r14,%rdi
call   1060 <fclose@plt>
lea    0xc75(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r14,%r14
je     13cf <main+0x1df>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
lea    0xc38(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/null\00"
@.str.1 = [2 x i8] c"a\00"
@stdin = global i32 0
@.str.2 = [6 x i8] c"Error\00"
@.str.3 = [5 x i8] c"make\00"
@stderr = global i32 0
@.str.4 = [7 x i8] c"error\0A\00"
@stdout = global i32 0
@.str.5 = [6 x i8] c"done\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %7
store i32 0, i32* %8
store i32* null, i32** %9
store i8* null, i8** %11
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %34
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %34
21: ; preds = %15
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %9
%26 = load i32*, i32** %9
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %33
28: ; preds = %21
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @perror(i8* %31)
br label %33
33: ; preds = %28, %21
br label %34
34: ; preds = %33, %15, %2
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 2
br i1 %36, label %37, label %48
37: ; preds = %34
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %12
%42 = load i32, i32* %12
%43 = icmp sgt i32 %42, 80
br i1 %43, label %44, label %47
44: ; preds = %37
%45 = load i32, i32* %12
%46 = sdiv i32 %45, 80
store i32 %46, i32* %7
br label %47
47: ; preds = %44, %37
br label %48
48: ; preds = %47, %34
br label %49
49: ; preds = %102, %48
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%51 = load i32, i32* @stdin
%52 = call i32* @fgets(i8* %50, i32 1024, i32 %51)
%53 = icmp ne i32* %52, null
br i1 %53, label %54, label %105
54: ; preds = %49
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1023
store i8 0, i8* %55
%56 = load i32*, i32** %9
%57 = icmp ne i32* %56, null
br i1 %57, label %58, label %62
58: ; preds = %54
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%60 = load i32*, i32** %9
%61 = call i32 @fputs(i8* %59, i32* %60)
br label %62
62: ; preds = %58, %54
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%64 = call i8* @strstr(i8* %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* %64, i8** %11
%65 = icmp ne i8* %64, null
br i1 %65, label %66, label %94
66: ; preds = %62
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%68 = call i32 @strlen(i8* %67)
%69 = sub nsw i32 %68, 10
store i32 %69, i32* %10
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%71 = call i8* @strstr(i8* %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%73 = icmp eq i8* %71, %72
br i1 %73, label %74, label %93
74: ; preds = %66
%75 = load i8*, i8** %11
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%77 = ptrtoint i8* %75 to i64
%78 = ptrtoint i8* %76 to i64
%79 = sub i64 %77, %78
%80 = load i32, i32* %10
%81 = sext i32 %80 to i64
%82 = icmp sgt i64 %79, %81
br i1 %82, label %83, label %93
83: ; preds = %74
%84 = load i32*, i32** %9
%85 = icmp ne i32* %84, null
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = load i32*, i32** %9
%88 = call i32 @fclose(i32* %87)
br label %89
89: ; preds = %86, %83
%90 = load i32, i32* @stderr
%91 = call i32 @fprintf(i32 %90, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %74, %66
br label %94
94: ; preds = %93, %62
%95 = load i32, i32* %8
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %102
97: ; preds = %94
%98 = call i32 @putchar(i8 signext 46)
%99 = load i32, i32* @stdout
%100 = call i32 @fflush(i32 %99)
%101 = load i32, i32* %7
store i32 %101, i32* %8
br label %102
102: ; preds = %97, %94
%103 = load i32, i32* %8
%104 = add nsw i32 %103, -1
store i32 %104, i32* %8
br label %49
105: ; preds = %49
%106 = load i32*, i32** %9
%107 = icmp ne i32* %106, null
br i1 %107, label %108, label %111
108: ; preds = %105
%109 = load i32*, i32** %9
%110 = call i32 @fclose(i32* %109)
br label %111
111: ; preds = %108, %105
%112 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/null\00"
@.str.1 = [2 x i8] c"a\00"
@stdin = global i32 0
@.str.2 = [6 x i8] c"Error\00"
@.str.3 = [5 x i8] c"make\00"
@stderr = global i32 0
@.str.4 = [7 x i8] c"error\0A\00"
@stdout = global i32 0
@str = [5 x i8] c"done\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %28
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %6
%12 = load i8*, i8** %7
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %1
%17 = tail call i32 @perror(i8* %16)
br label %18
18: ; preds = %11, %15, %6
%19 = phi i32* [ null, %15 ], [ %13, %11 ], [ null, %6 ]
%20 = icmp ugt i32 %0, 2
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = icmp sgt i32 %24, 80
%26 = sdiv i32 %24, 80
%27 = select i1 %25, i32 %26, i32 10
br label %28
28: ; preds = %2, %21, %18
%29 = phi i32* [ %19, %21 ], [ %19, %18 ], [ null, %2 ]
%30 = phi i32 [ %27, %21 ], [ 10, %18 ], [ 10, %2 ]
%31 = load i32, i32* @stdin
%32 = call i32* @fgets(i8* %4, i32 1024, i32 %31)
%33 = icmp eq i32* %32, null
br i1 %33, label %75, label %34
34: ; preds = %28
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
%36 = icmp eq i32* %29, null
%37 = ptrtoint [1024 x i8]* %3 to i64
br label %38
38: ; preds = %34, %69
%39 = phi i32 [ 0, %34 ], [ %71, %69 ]
store i8 0, i8* %35
br i1 %36, label %42, label %40
40: ; preds = %38
%41 = call i32 @fputs(i8* %4, i32* %29)
br label %42
42: ; preds = %40, %38
%43 = call i8* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%44 = icmp eq i8* %43, null
br i1 %44, label %63, label %45
45: ; preds = %42
%46 = call i32 @strlen(i8* %4)
%47 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%48 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %63
50: ; preds = %45
%51 = add nsw i32 %46, -10
%52 = ptrtoint i8* %43 to i64
%53 = sub i64 %52, %37
%54 = sext i32 %51 to i64
%55 = icmp sgt i64 %53, %54
br i1 %55, label %56, label %63
56: ; preds = %50
br i1 %36, label %59, label %57
57: ; preds = %56
%58 = call i32 @fclose(i32* %29)
br label %59
59: ; preds = %57, %56
%60 = load i32, i32* @stderr
%61 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %45, %50, %42
%64 = icmp eq i32 %39, 0
br i1 %64, label %65, label %69
65: ; preds = %63
%66 = call i32 @putchar(i8 signext 46)
%67 = load i32, i32* @stdout
%68 = call i32 @fflush(i32 %67)
br label %69
69: ; preds = %65, %63
%70 = phi i32 [ %30, %65 ], [ %39, %63 ]
%71 = add nsw i32 %70, -1
%72 = load i32, i32* @stdin
%73 = call i32* @fgets(i8* %4, i32 1024, i32 %72)
%74 = icmp eq i32* %73, null
br i1 %74, label %75, label %38
75: ; preds = %69, %28
%76 = icmp eq i32* %29, null
br i1 %76, label %79, label %77
77: ; preds = %75
%78 = call i32 @fclose(i32* %29)
br label %79
79: ; preds = %77, %75
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}