#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 /*<<< orphan*/ strcpy(char *, char *);
int SeparateComma(char *argv, int nc2s, char vet[20][20], int *n) {
  int i, r = 0, c = 0;
  char szTmp[20];
  for (i = 0; i <= nc2s; i++) {
    if (r > 20)
      return 1;
    szTmp[c] = argv[i];
    c++;
    if (argv[i] == ',') {
      szTmp[c - 1] = 0;
      c = 0;
      strcpy(vet[r], szTmp);
      r++;
    }
  }
  szTmp[c - 1] = 0;
  c = 0;
  strcpy(vet[r], szTmp);
  *n = r + 1;
  return 1;
}


x86 assembly (clang, -O0):
<SeparateComma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11d7 <SeparateComma+0xc7>
cmpl   $0x14,-0x30(%rbp)
jle    115e <SeparateComma+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1216 <SeparateComma+0x106>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x34(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    11c4 <SeparateComma+0xb4>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x50(%rbp,%rax,1)
movl   $0x0,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x30(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11c9 <SeparateComma+0xb9>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113c <SeparateComma+0x2c>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x50(%rbp,%rax,1)
movl   $0x0,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x30(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%ecx
add    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SeparateComma>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x8(%rsp)
mov    %rdx,%r15
test   %esi,%esi
js     1181 <SeparateComma+0x71>
mov    %esi,%ebx
mov    %rdi,%r12
add    $0x1,%ebx
xor    %r14d,%r14d
lea    0x10(%rsp),%r13
xor    %eax,%eax
xor    %ebp,%ebp
jmp    1166 <SeparateComma+0x56>
movb   $0x0,0x10(%rsp,%rcx,1)
movslq %ebp,%rax
lea    (%rax,%rax,4),%rax
lea    (%r15,%rax,4),%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
add    $0x1,%ebp
xor    %eax,%eax
add    $0x1,%r14
cmp    %r14,%rbx
je     1185 <SeparateComma+0x75>
cmp    $0x14,%ebp
jg     11ab <SeparateComma+0x9b>
movzbl (%r12,%r14,1),%edx
movslq %eax,%rcx
mov    %dl,0x10(%rsp,%rcx,1)
cmp    $0x2c,%dl
je     1140 <SeparateComma+0x30>
add    $0x1,%eax
jmp    115d <SeparateComma+0x4d>
xor    %ebp,%ebp
xor    %eax,%eax
cltq
lea    0x10(%rsp),%rsi
movb   $0x0,-0x1(%rax,%rsi,1)
movslq %ebp,%rbx
lea    (%rbx,%rbx,4),%rax
lea    (%r15,%rax,4),%rdi
call   1030 <strcpy@plt>
add    $0x1,%ebx
mov    0x8(%rsp),%rax
mov    %ebx,(%rax)
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SeparateComma(i8* %0, i32 %1, [20 x i8]* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [20 x i8]*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [20 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store [20 x i8]* %2, [20 x i8]** %8
store i32* %3, i32** %9
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %10
br label %14
14: ; preds = %55, %4
%15 = load i32, i32* %10
%16 = load i32, i32* %7
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %58
18: ; preds = %14
%19 = load i32, i32* %11
%20 = icmp sgt i32 %19, 20
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 1, i32* %5
br label %73
22: ; preds = %18
%23 = load i8*, i8** %6
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = load i32, i32* %12
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 %29
store i8 %27, i8* %30
%31 = load i32, i32* %12
%32 = add nsw i32 %31, 1
store i32 %32, i32* %12
%33 = load i8*, i8** %6
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 44
br i1 %39, label %40, label %54
40: ; preds = %22
%41 = load i32, i32* %12
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 %43
store i8 0, i8* %44
store i32 0, i32* %12
%45 = load [20 x i8]*, [20 x i8]** %8
%46 = load i32, i32* %11
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %45, i64 %47
%49 = getelementptr inbounds [20 x i8], [20 x i8]* %48, i64 0, i64 0
%50 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 0
%51 = call i32 @strcpy(i8* %49, i8* %50)
%52 = load i32, i32* %11
%53 = add nsw i32 %52, 1
store i32 %53, i32* %11
br label %54
54: ; preds = %40, %22
br label %55
55: ; preds = %54
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %14
58: ; preds = %14
%59 = load i32, i32* %12
%60 = sub nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 %61
store i8 0, i8* %62
store i32 0, i32* %12
%63 = load [20 x i8]*, [20 x i8]** %8
%64 = load i32, i32* %11
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %63, i64 %65
%67 = getelementptr inbounds [20 x i8], [20 x i8]* %66, i64 0, i64 0
%68 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 0, i64 0
%69 = call i32 @strcpy(i8* %67, i8* %68)
%70 = load i32, i32* %11
%71 = add nsw i32 %70, 1
%72 = load i32*, i32** %9
store i32 %71, i32* %72
store i32 1, i32* %5
br label %73
73: ; preds = %58, %21
%74 = load i32, i32* %5
ret i32 %74
}

LLVM IR (-O2):
define i32 @SeparateComma(i8* nocapture %0, i32 %1, [20 x i8]* %2, i32* nocapture writeonly %3) {
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%7 = icmp slt i32 %1, 0
br i1 %7, label %33, label %8
8: ; preds = %4
%9 = add nuw i32 %1, 1
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %8, %28
%12 = phi i64 [ 0, %8 ], [ %31, %28 ]
%13 = phi i32 [ 0, %8 ], [ %30, %28 ]
%14 = phi i32 [ 0, %8 ], [ %29, %28 ]
%15 = icmp sgt i32 %14, 20
br i1 %15, label %43, label %16
16: ; preds = %11
%17 = getelementptr inbounds i8, i8* %0, i64 %12
%18 = load i8, i8* %17
%19 = sext i32 %13 to i64
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %19
store i8 %18, i8* %20
%21 = add nsw i32 %13, 1
%22 = icmp eq i8 %18, 44
br i1 %22, label %23, label %28
23: ; preds = %16
store i8 0, i8* %20
%24 = sext i32 %14 to i64
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 %24, i64 0
%26 = call i32 @strcpy(i8* %25, i8* %6)
%27 = add nsw i32 %14, 1
br label %28
28: ; preds = %16, %23
%29 = phi i32 [ %27, %23 ], [ %14, %16 ]
%30 = phi i32 [ 0, %23 ], [ %21, %16 ]
%31 = add nuw nsw i64 %12, 1
%32 = icmp eq i64 %31, %10
br i1 %32, label %33, label %11
33: ; preds = %28, %4
%34 = phi i32 [ 0, %4 ], [ %29, %28 ]
%35 = phi i32 [ 0, %4 ], [ %30, %28 ]
%36 = add nsw i32 %35, -1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %37
store i8 0, i8* %38
%39 = sext i32 %34 to i64
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 %39, i64 0
%41 = call i32 @strcpy(i8* %40, i8* %6)
%42 = add nsw i32 %34, 1
store i32 %42, i32* %3
br label %43
43: ; preds = %11, %33
ret i32 1
}