#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 character_count(char, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pad_zeros(int);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char input_buffer[1024];
  int leading_column_count;
  int caridean_shrimp_count;
  int crab_count;
  int fish_count;
  int penaeid_shrimp_count;
  int commas_to_expect;
  int comma_count;
  if (argc != 6) {
    fprintf(stderr,
            "Usage: %s leading_column_count caridean_shrimp_count crab_count "
            "fish_count penaeid_shrimp_count\n",
            argv[0]);
    exit(1);
  }
  leading_column_count = atoi(argv[1]);
  caridean_shrimp_count = atoi(argv[2]);
  crab_count = atoi(argv[3]);
  fish_count = atoi(argv[4]);
  penaeid_shrimp_count = atoi(argv[5]);
  commas_to_expect = leading_column_count - 2;
  commas_to_expect += (caridean_shrimp_count);
  commas_to_expect += (crab_count);
  commas_to_expect += (fish_count);
  commas_to_expect += (penaeid_shrimp_count);
  while (get_line(input_buffer, stdin)) {
    comma_count = character_count(',', input_buffer);
    printf("%s%s\n", input_buffer, pad_zeros(commas_to_expect - comma_count));
  }
  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)
cmpl   $0x6,-0x8(%rbp)
je     11b9 <main+0x49>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe56(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x414(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x418(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x41c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x420(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x424(%rbp)
mov    -0x414(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x428(%rbp)
mov    -0x418(%rbp),%eax
add    -0x428(%rbp),%eax
mov    %eax,-0x428(%rbp)
mov    -0x41c(%rbp),%eax
add    -0x428(%rbp),%eax
mov    %eax,-0x428(%rbp)
mov    -0x420(%rbp),%eax
add    -0x428(%rbp),%eax
mov    %eax,-0x428(%rbp)
mov    -0x424(%rbp),%eax
add    -0x428(%rbp),%eax
mov    %eax,-0x428(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2d6b(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     12de <main+0x16e>
lea    -0x410(%rbp),%rsi
mov    $0x2c,%edi
call   1070 <character_count@plt>
mov    %eax,-0x42c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    -0x428(%rbp),%edi
sub    -0x42c(%rbp),%edi
call   1040 <pad_zeros@plt>
mov    -0x438(%rbp),%rsi
mov    %eax,%edx
lea    0xd8d(%rip),%rdi
call   1050 <printf@plt>
jmp    126f <main+0xff>
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    $0x408,%rsp
mov    %rsi,%rbx
cmp    $0x6,%edi
jne    1248 <main+0xd8>
mov    0x8(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r12d
mov    0x20(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    0x28(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
mov    0x2e1a(%rip),%r13
mov    0x0(%r13),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     1234 <main+0xc4>
add    %r15d,%r14d
add    %r12d,%r14d
add    %ebp,%r14d
lea    (%rbx,%r14,1),%ebp
add    $0xfffffffe,%ebp
mov    %rsp,%rbx
lea    0xe68(%rip),%r14
nopl   0x0(%rax)
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1070 <character_count@plt>
mov    %ebp,%edi
sub    %eax,%edi
call   1040 <pad_zeros@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <printf@plt>
mov    0x0(%r13),%esi
mov    %rbx,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    1200 <main+0x90>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xda5(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [97 x i8] c"Usage: %s leading_column_count caridean_shrimp_count crab_count fish_count penaeid_shrimp_count\0A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%s%s\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 i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 6
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %8
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
store i32 %35, i32* %9
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 4
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %10
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 5
%42 = load i8*, i8** %41
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %11
%44 = load i32, i32* %7
%45 = sub nsw i32 %44, 2
store i32 %45, i32* %12
%46 = load i32, i32* %8
%47 = load i32, i32* %12
%48 = add nsw i32 %47, %46
store i32 %48, i32* %12
%49 = load i32, i32* %9
%50 = load i32, i32* %12
%51 = add nsw i32 %50, %49
store i32 %51, i32* %12
%52 = load i32, i32* %10
%53 = load i32, i32* %12
%54 = add nsw i32 %53, %52
store i32 %54, i32* %12
%55 = load i32, i32* %11
%56 = load i32, i32* %12
%57 = add nsw i32 %56, %55
store i32 %57, i32* %12
br label %58
58: ; preds = %63, %23
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%60 = load i32, i32* @stdin
%61 = call i64 @get_line(i8* %59, i32 %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %72
63: ; preds = %58
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%65 = call i32 @character_count(i8 signext 44, i8* %64)
store i32 %65, i32* %13
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%67 = load i32, i32* %12
%68 = load i32, i32* %13
%69 = sub nsw i32 %67, %68
%70 = call i32 @pad_zeros(i32 %69)
%71 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %66, i32 %70)
br label %58
72: ; preds = %58
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [97 x i8] c"Usage: %s leading_column_count caridean_shrimp_count crab_count fish_count penaeid_shrimp_count\0A\00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%s%s\0A\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 eq i32 %0, 6
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 4
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = getelementptr inbounds i8*, i8** %1, i64 5
%25 = load i8*, i8** %24
%26 = tail call i32 @atoi(i8* %25)
%27 = add nsw i32 %14, -2
%28 = add nsw i32 %27, %17
%29 = add nsw i32 %28, %20
%30 = add nsw i32 %29, %23
%31 = add nsw i32 %30, %26
%32 = load i32, i32* @stdin
%33 = call i64 @get_line(i8* %4, i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %43, label %35
35: ; preds = %11, %35
%36 = call i32 @character_count(i8 signext 44, i8* %4)
%37 = sub i32 %31, %36
%38 = call i32 @pad_zeros(i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %38)
%40 = load i32, i32* @stdin
%41 = call i64 @get_line(i8* %4, i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %35
43: ; preds = %35, %11
ret i32 0
}