#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 *);
char *strchr(char *, char);
void input_int(char *arg, int intarr[], int maxint, int *nintfound) {
  int nint = 0;
  intarr[nint++] = atoi(arg);
  while ((arg = strchr(arg, ',')) && (nint < maxint))
    intarr[nint++] = atoi(++arg);
  *nintfound = nint;
}


x86 assembly (clang, -O0):
<input_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    %rcx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x25(%rbp)
je     118e <input_int+0x6e>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    119e <input_int+0x7e>
jmp    11cb <input_int+0xab>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x8(%rbp)
call   1040 <atoi@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    115e <input_int+0x3e>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_int>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%r12d
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <atoi@plt>
mov    %eax,(%r15)
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     119e <input_int+0x7e>
cmp    $0x2,%r12d
jl     119e <input_int+0x7e>
mov    %rax,%rbx
mov    %r12d,%r12d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %eax,(%r15,%rbp,4)
add    $0x1,%rbp
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     119e <input_int+0x7e>
mov    %rax,%rbx
cmp    %r12,%rbp
jb     1170 <input_int+0x50>
mov    %ebp,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @input_int(i8* %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
store i32 0, i32* %9
%10 = load i8*, i8** %5
%11 = call i32 @atoi(i8* %10)
%12 = load i32*, i32** %6
%13 = load i32, i32* %9
%14 = add nsw i32 %13, 1
store i32 %14, i32* %9
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
store i32 %11, i32* %16
br label %17
17: ; preds = %27, %4
%18 = load i8*, i8** %5
%19 = call i8* @strchr(i8* %18, i8 signext 44)
store i8* %19, i8** %5
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* %9
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br label %25
25: ; preds = %21, %17
%26 = phi i1 [ false, %17 ], [ %24, %21 ]
br i1 %26, label %27, label %36
27: ; preds = %25
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %5
%30 = call i32 @atoi(i8* %29)
%31 = load i32*, i32** %6
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds i32, i32* %31, i64 %34
store i32 %30, i32* %35
br label %17
36: ; preds = %25
%37 = load i32, i32* %9
%38 = load i32*, i32** %8
store i32 %37, i32* %38
ret void
}

LLVM IR (-O2):
define void @input_int(i8* %0, i32* nocapture writeonly %1, i32 %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @atoi(i8* %0)
store i32 %5, i32* %1
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 44)
%7 = icmp ne i8* %6, null
%8 = icmp sgt i32 %2, 1
%9 = and i1 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %4
%11 = zext i32 %2 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 1, %10 ], [ %17, %12 ]
%14 = phi i8* [ %6, %10 ], [ %19, %12 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = tail call i32 @atoi(i8* %15)
%17 = add nuw nsw i64 %13, 1
%18 = getelementptr inbounds i32, i32* %1, i64 %13
store i32 %16, i32* %18
%19 = tail call i8* @strchr(i8* dereferenceable(1) %15, i8 signext 44)
%20 = icmp ne i8* %19, null
%21 = icmp ult i64 %17, %11
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %12, label %23
23: ; preds = %12
%24 = trunc i64 %17 to i32
br label %25
25: ; preds = %23, %4
%26 = phi i32 [ 1, %4 ], [ %24, %23 ]
store i32 %26, i32* %3
ret void
}