// File: /workspace/github_c_makefile_star2_O3/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, %r13
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 0x1284
cmpb $0x77, 0x1(%rax)
jne 0x11e3
cmpb $0x0, 0x2(%rax)
je 0x12e2
cmpb $0x63, 0x1(%rax)
jne 0x11f3
cmpb $0x0, 0x2(%rax)
je 0x13a8
leaq 0xe25(%rip), %rdi       # 0x201f
jmp 0x1203
leaq 0xe07(%rip), %rdi       # 0x200a
callq 0x1030
callq 0x14e2
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r13), %rax
cmpb $0x2d, (%rax)
jne 0x1231
cmpb $0x0, 0x1(%rax)
je 0x1416
movl %edi, %ebx
xorl %ebp, %ebp
movl $0x2, %r12d
leaq 0xdc6(%rip), %r14       # 0x2008
movq (%r13,%r12,8), %rdi
movq %r14, %rsi
callq 0x1060
testq %rax, %rax
je 0x1277
movq %rax, %r15
movq %r15, %rdi
callq 0x1070
cmpb $-0x1, %al
je 0x126f
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x1257
incl %ebp
jmp 0x1257
movq %r15, %rdi
callq 0x1040
incq %r12
cmpq %rbx, %r12
jne 0x1242
jmp 0x1401
movq 0x10(%r13), %rax
cmpb $0x2d, (%rax)
jne 0x1297
cmpb $0x0, 0x1(%rax)
je 0x1439
movl %edi, %ebx
xorl %ebp, %ebp
movl $0x2, %r12d
leaq 0xd60(%rip), %r14       # 0x2008
movq (%r13,%r12,8), %rdi
movq %r14, %rsi
callq 0x1060
testq %rax, %rax
je 0x12d5
movq %rax, %r15
decl %ebp
movq %r15, %rdi
callq 0x1070
incl %ebp
cmpb $-0x1, %al
jne 0x12bf
movq %r15, %rdi
callq 0x1040
incq %r12
cmpq %rbx, %r12
jne 0x12a8
jmp 0x1401
movq 0x10(%r13), %rax
cmpb $0x2d, (%rax)
jne 0x12f5
cmpb $0x0, 0x1(%rax)
je 0x1455
movl %edi, %eax
movq %rax, 0x8(%rsp)
movl $0x2, %ebx
xorl %ebp, %ebp
movq %r13, (%rsp)
movq (%r13,%rbx,8), %rdi
leaq 0xcf5(%rip), %rsi       # 0x2008
callq 0x1060
testq %rax, %rax
je 0x1398
movq %rax, %r15
movq %rbx, 0x10(%rsp)
movq %rax, %rdi
callq 0x1070
movl %eax, %r13d
shll $0x18, %r13d
cmpl $0xff000000, %r13d      # imm = 0xFF000000
je 0x1387
xorl %r14d, %r14d
callq 0x1080
movq %rax, %r12
sarl $0x18, %r13d
movq (%r12), %rax
movslq %r13d, %rcx
movzwl (%rax,%rcx,2), %eax
xorl %ebx, %ebx
btl $0xd, %eax
setae %bl
movl $0x0, %eax
cmovael %eax, %r14d
addl %r14d, %ebp
movq %r15, %rdi
callq 0x1070
movl %eax, %r13d
shll $0x18, %r13d
movl %ebx, %r14d
cmpl $0xff000000, %r13d      # imm = 0xFF000000
jne 0x1348
movq %r15, %rdi
callq 0x1040
movq (%rsp), %r13
movq 0x10(%rsp), %rbx
incq %rbx
cmpq 0x8(%rsp), %rbx
jne 0x1307
jmp 0x1401
movq 0x10(%r13), %rax
cmpb $0x2d, (%rax)
jne 0x13bb
cmpb $0x0, 0x1(%rax)
je 0x14ba
movl %edi, %ebx
xorl %ebp, %ebp
movl $0x2, %r12d
leaq 0xc3c(%rip), %r14       # 0x2008
movq (%r13,%r12,8), %rdi
movq %r14, %rsi
callq 0x1060
testq %rax, %rax
je 0x13f9
movq %rax, %r15
decl %ebp
movq %r15, %rdi
callq 0x1070
incl %ebp
cmpb $-0x1, %al
jne 0x13e3
movq %r15, %rdi
callq 0x1040
incq %r12
cmpq %rbx, %r12
jne 0x13cc
leaq 0xbfc(%rip), %rdi       # 0x2004
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x120d
movq 0x2bc3(%rip), %r14      # 0x3fe0
movq (%r14), %rdi
callq 0x1070
cmpb $-0x1, %al
je 0x14d4
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x141d
incl %ebx
jmp 0x141d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x2b9b(%rip), %r14      # 0x3fe0
movq (%r14), %rdi
callq 0x1070
incl %ebx
cmpb $-0x1, %al
jne 0x1445
jmp 0x14d4
movq 0x2b84(%rip), %r15      # 0x3fe0
movq (%r15), %rdi
callq 0x1070
movl %eax, %ebp
shll $0x18, %ebp
xorl %ebx, %ebx
cmpl $0xff000000, %ebp       # imm = 0xFF000000
je 0x14d4
xorl %r12d, %r12d
callq 0x1080
movq %rax, %r14
xorl %eax, %eax
xorl %ebx, %ebx
sarl $0x18, %ebp
movq (%r14), %rcx
movslq %ebp, %rdx
movzwl (%rcx,%rdx,2), %ecx
xorl %r13d, %r13d
btl $0xd, %ecx
setae %r13b
cmovael %r12d, %eax
addl %eax, %ebx
movq (%r15), %rdi
callq 0x1070
movl %eax, %ebp
shll $0x18, %ebp
movl %r13d, %eax
cmpl $0xff000000, %ebp       # imm = 0xFF000000
jne 0x1482
jmp 0x14d4
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x2b1a(%rip), %r14      # 0x3fe0
movq (%r14), %rdi
callq 0x1070
incl %ebx
cmpb $-0x1, %al
jne 0x14c6
leaq 0xb29(%rip), %rdi       # 0x2004
movl %ebx, %esi
jmp 0x140a