// File: /workspace/github_c_makefile_star2_O2/keiranrowan[P]tiny-core/./src/wc.c
// Function: main
int main(int argc, char **argv) {
	if (argc > 2) {
		if (strcmp(argv[1], "-h") == 0) {
			help();
		} else if (strcmp(argv[1], "-l") == 0) {
			if (strcmp(argv[2], "-") == 0) { 
			    int n;
				char ch;

				while ((ch = getc(stdin)) != EOF) {
					if (ch == '\n') {
						n++;
					}
				}

				printf("%i\n", n);
			} else {
				int i, n = 0;
				for (i = 2; i < argc; i++) {
					FILE *fp;
					char ch;
					
					fp = fopen(argv[i], "r");
					if (fp) {
						while ((ch = getc(fp)) != EOF) {
							if (ch == '\n') {
								n++;
							}
						}
						fclose(fp);
					}
				}
				
				printf("%i\n", n);
			}
		} else if (strcmp(argv[1], "-b") == 0) {
			if (strcmp(argv[2], "-") == 0) {
				int n = 0;
				char ch;

				while ((ch = getc(stdin)) != EOF) {
					n++;
				}

				printf("%i\n", n);
			} else {
				int i, n = 0;
				for (i = 2; i < argc; i++) {
					FILE *fp;
					char ch;
					
					fp = fopen(argv[i], "r");
					if (fp) {
						while ((ch = getc(fp)) != EOF) {
							n++;
						}
						fclose(fp);
					}
				}
				
				printf("%i\n", n);
			}
		} else if (strcmp(argv[1], "-w") == 0) {
			if (strcmp(argv[2], "-") == 0) {
				int n = 0, alpha = 0;
				char ch;

				while ((ch = getc(stdin)) != EOF) {
					if (!isspace(ch)) {
						alpha = 1;
					} else {
						if (alpha) {
							alpha = 0;
							n++;
						}
					}
				}

				printf("%i\n", n);
			} else {
				int i, n = 0;
				for (i = 2; i < argc; i++) {
					FILE *fp;
					char ch;
					
					fp = fopen(argv[i], "r");
					if (fp) {
						int alpha = 0;
						
						while ((ch = getc(fp)) != EOF) {
							if (!isspace(ch)) {
								alpha = 1;
							} else {
								if (alpha) {
									alpha = 0;
									n++;
								}
							}
						}
						fclose(fp);
					}
				}
				
				printf("%i\n", n);
			}
		} else if (strcmp(argv[1], "-c") == 0) {
			if (strcmp(argv[2], "-") == 0) {
				int n = 0;
				char ch;
				
				while ((ch = getc(stdin)) != EOF) {
					if (!(ch == '\n') || !(ch == '\t') || !(ch == ' ')) {
						n++;
					}
				}
				
				printf("%i\n", n);
			} else {
				int i, n = 0;
				for (i = 2; i < argc; i++) {
					FILE *fp;
					char ch;
					
					fp = fopen(argv[i], "r");
					if (fp) {
						while ((ch = getc(fp)) != EOF) {
							if (!(ch == '\n') || !(ch == '\t') || !(ch == ' ')) {
								n++;
							}
						}
						fclose(fp);
					}
				}
				
				printf("%i\n", n);
			}
		} else {
			printf("Missing flags...\n");
			help();
		}
	} else {
		printf("Invalid arguments...\n");
		help();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x3, %edi
jl 0x11fc
movq %rsi, %rbx
movq 0x8(%rsi), %rax
cmpb $0x2d, (%rax)
jne 0x11f3
cmpb $0x68, 0x1(%rax)
jne 0x11b7
cmpb $0x0, 0x2(%rax)
je 0x1208
cmpb $0x6c, 0x1(%rax)
jne 0x11c3
cmpb $0x0, 0x2(%rax)
je 0x121e
cmpb $0x62, 0x1(%rax)
jne 0x11d3
cmpb $0x0, 0x2(%rax)
je 0x1283
cmpb $0x77, 0x1(%rax)
jne 0x11e3
cmpb $0x0, 0x2(%rax)
je 0x12e0
cmpb $0x63, 0x1(%rax)
jne 0x11f3
cmpb $0x0, 0x2(%rax)
je 0x137a
leaq 0xe25(%rip), %rdi       # 0x201f
jmp 0x1203
leaq 0xe07(%rip), %rdi       # 0x200a
callq 0x1030
callq 0x1493
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x1231
cmpb $0x0, 0x1(%rax)
je 0x13e8
movl %edi, %r12d
xorl %ebp, %ebp
pushq $0x2
popq %r13
leaq 0xdc7(%rip), %r14       # 0x2008
cmpq %r12, %r13
jae 0x13d3
movq (%rbx,%r13,8), %rdi
movq %r14, %rsi
callq 0x1060
testq %rax, %rax
je 0x127e
movq %rax, %r15
movq %r15, %rdi
callq 0x1070
cmpb $-0x1, %al
je 0x1276
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x125e
incl %ebp
jmp 0x125e
movq %r15, %rdi
callq 0x1040
incq %r13
jmp 0x1241
movq 0x10(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x1296
cmpb $0x0, 0x1(%rax)
je 0x140b
movl %edi, %r12d
xorl %ebp, %ebp
pushq $0x2
popq %r13
leaq 0xd62(%rip), %r14       # 0x2008
cmpq %r12, %r13
jae 0x13d3
movq (%rbx,%r13,8), %rdi
movq %r14, %rsi
callq 0x1060
testq %rax, %rax
je 0x12db
movq %rax, %r15
decl %ebp
movq %r15, %rdi
callq 0x1070
incl %ebp
cmpb $-0x1, %al
jne 0x12c5
movq %r15, %rdi
callq 0x1040
incq %r13
jmp 0x12a6
movq 0x10(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x12f3
cmpb $0x0, 0x1(%rax)
je 0x1425
movl %edi, %eax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
pushq $0x2
popq %r13
xorl %ebp, %ebp
movq %rbx, 0x8(%rsp)
cmpq 0x10(%rsp), %r13
jae 0x13d3
movq (%rbx,%r13,8), %rdi
leaq 0xcea(%rip), %rsi       # 0x2008
callq 0x1060
testq %rax, %rax
je 0x1375
movq %rax, %r15
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x1070
movl %eax, %r12d
shll $0x18, %r12d
cmpl $0xff000000, %r12d      # imm = 0xFF000000
je 0x1368
sarl $0x18, %r12d
callq 0x1080
movq (%rax), %rax
movslq %r12d, %rcx
xorl %edx, %edx
testb $0x20, 0x1(%rax,%rcx,2)
sete %dl
cmovel %r14d, %ebx
addl %ebx, %ebp
movl %edx, %ebx
jmp 0x132d
movq %r15, %rdi
callq 0x1040
movq 0x8(%rsp), %rbx
incq %r13
jmp 0x1308
movq 0x10(%rbx), %rax
cmpb $0x2d, (%rax)
jne 0x138d
cmpb $0x0, 0x1(%rax)
je 0x146d
movl %edi, %r12d
xorl %ebp, %ebp
pushq $0x2
popq %r13
leaq 0xc6b(%rip), %r14       # 0x2008
cmpq %r12, %r13
jae 0x13d3
movq (%rbx,%r13,8), %rdi
movq %r14, %rsi
callq 0x1060
testq %rax, %rax
je 0x13ce
movq %rax, %r15
decl %ebp
movq %r15, %rdi
callq 0x1070
incl %ebp
cmpb $-0x1, %al
jne 0x13b8
movq %r15, %rdi
callq 0x1040
incq %r13
jmp 0x139d
leaq 0xc2a(%rip), %rdi       # 0x2004
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x120d
movq 0x2bf1(%rip), %r14      # 0x3fe0
movq (%r14), %rdi
callq 0x1070
cmpb $-0x1, %al
je 0x1485
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x13ef
incl %ebx
jmp 0x13ef
pushq $-0x1
popq %rbx
movq 0x2bcb(%rip), %r14      # 0x3fe0
movq (%r14), %rdi
callq 0x1070
incl %ebx
cmpb $-0x1, %al
jne 0x1415
jmp 0x1485
xorl %r14d, %r14d
movq 0x2bb1(%rip), %r15      # 0x3fe0
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%r15), %rdi
callq 0x1070
movl %eax, %ebp
shll $0x18, %ebp
cmpl $0xff000000, %ebp       # imm = 0xFF000000
je 0x1485
sarl $0x18, %ebp
callq 0x1080
movq (%rax), %rax
movslq %ebp, %rcx
xorl %edx, %edx
testb $0x20, 0x1(%rax,%rcx,2)
sete %dl
cmovel %r14d, %r12d
addl %r12d, %ebx
movl %edx, %r12d
jmp 0x1434
pushq $-0x1
popq %rbx
movq 0x2b69(%rip), %r14      # 0x3fe0
movq (%r14), %rdi
callq 0x1070
incl %ebx
cmpb $-0x1, %al
jne 0x1477
leaq 0xb78(%rip), %rdi       # 0x2004
movl %ebx, %esi
jmp 0x13dc