#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 EXIT_SUCCESS;
int spitString(char *, char, char **, int *);
int main01() {
  char *p = "abcdef,acccd,eeee,aaaa,e3eeee,ssss,";
  char buf[10][30] = {0};
  int n = 0;
  int ret = 0;
  ret = spitString(p, ',', buf, &n);
  if (ret != 0) {
    return ret;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1040 <memset@plt>
movl   $0x0,-0x144(%rbp)
movl   $0x0,-0x148(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x140(%rbp),%rdx
mov    $0x2c,%esi
lea    -0x144(%rbp),%rcx
call   1030 <spitString@plt>
mov    %eax,-0x148(%rbp)
cmpl   $0x0,-0x148(%rbp)
je     119a <main01+0x7a>
mov    -0x148(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <main01+0x86>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main01>:
push   %rbx
sub    $0x140,%rsp
lea    0x10(%rsp),%rbx
mov    $0x12c,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
movl   $0x0,0xc(%rsp)
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rcx
mov    $0x2c,%esi
mov    %rbx,%rdx
call   1030 <spitString@plt>
test   %eax,%eax
jne    116a <main01+0x4a>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
add    $0x140,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"abcdef,acccd,eeee,aaaa,e3eeee,ssss,\00"
@EXIT_SUCCESS = global i32 0
define i32 @main01() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [10 x [30 x i8]]
%4 = alloca i32
%5 = alloca i32
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8** %2
%6 = bitcast [10 x [30 x i8]]* %3 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %3, i64 0, i64 0
%9 = bitcast [30 x i8]* %8 to i8**
%10 = call i32 @spitString(i8* %7, i8 signext 44, i8** %9, i32* %4)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = load i32, i32* %5
store i32 %14, i32* %1
br label %17
15: ; preds = %0
%16 = load i32, i32* @EXIT_SUCCESS
store i32 %16, i32* %1
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [36 x i8] c"abcdef,acccd,eeee,aaaa,e3eeee,ssss,\00"
@EXIT_SUCCESS = global i32 0
define i32 @main01() {
%1 = alloca [10 x [30 x i8]]
%2 = alloca i32
%3 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %1, i64 0, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast [10 x [30 x i8]]* %1 to i8**
%6 = call i32 @spitString(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8 signext 44, i8** %5, i32* %2)
%7 = icmp eq i32 %6, 0
%8 = load i32, i32* @EXIT_SUCCESS
%9 = select i1 %7, i32 %8, i32 %6
ret i32 %9
}