#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 const *);
int get_ival(char const *, int, int, int, int *);
int strlen(char const *);
void split_intstring(const char *intstr, int *first, int *last, int *inc) {
  int i, start;
  int istrlen;
  istrlen = strlen(intstr);
  *first = atoi(intstr);
  *last = *first;
  *inc = 1;
  start = 1;
  *last = get_ival(intstr, *first, start, istrlen, &i);
  if (i < istrlen) {
    start = i + 1;
    *inc = get_ival(intstr, 1, start, istrlen, &i);
  }
}


x86 assembly (clang, -O0):
<split_intstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    -0x24(%rbp),%r8
call   1050 <get_ival@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11d8 <split_intstring+0xa8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    $0x1,%esi
lea    -0x24(%rbp),%r8
call   1050 <get_ival@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_intstring>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %eax,0x0(%rbp)
mov    %eax,(%r15)
movl   $0x1,(%r14)
mov    0x0(%rbp),%esi
lea    0xc(%rsp),%r8
mov    %rbx,%rdi
mov    $0x1,%edx
mov    %r12d,%ecx
call   1050 <get_ival@plt>
mov    %eax,(%r15)
mov    0xc(%rsp),%edx
cmp    %r12d,%edx
jge    11a4 <split_intstring+0x74>
add    $0x1,%edx
lea    0xc(%rsp),%r8
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r12d,%ecx
call   1050 <get_ival@plt>
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @split_intstring(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%12 = load i8*, i8** %5
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %11
%14 = load i8*, i8** %5
%15 = call i32 @atoi(i8* %14)
%16 = load i32*, i32** %6
store i32 %15, i32* %16
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = load i32*, i32** %7
store i32 %18, i32* %19
%20 = load i32*, i32** %8
store i32 1, i32* %20
store i32 1, i32* %10
%21 = load i8*, i8** %5
%22 = load i32*, i32** %6
%23 = load i32, i32* %22
%24 = load i32, i32* %10
%25 = load i32, i32* %11
%26 = call i32 @get_ival(i8* %21, i32 %23, i32 %24, i32 %25, i32* %9)
%27 = load i32*, i32** %7
store i32 %26, i32* %27
%28 = load i32, i32* %9
%29 = load i32, i32* %11
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %39
31: ; preds = %4
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %10
%34 = load i8*, i8** %5
%35 = load i32, i32* %10
%36 = load i32, i32* %11
%37 = call i32 @get_ival(i8* %34, i32 1, i32 %35, i32 %36, i32* %9)
%38 = load i32*, i32** %8
store i32 %37, i32* %38
br label %39
39: ; preds = %31, %4
ret void
}

LLVM IR (-O2):
define void @split_intstring(i8* %0, i32* nocapture %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = tail call i32 @strlen(i8* %0)
%8 = tail call i32 @atoi(i8* %0)
store i32 %8, i32* %1
store i32 %8, i32* %2
store i32 1, i32* %3
%9 = load i32, i32* %1
%10 = call i32 @get_ival(i8* %0, i32 %9, i32 1, i32 %7, i32* %5)
store i32 %10, i32* %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, %7
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = add nsw i32 %11, 1
%15 = call i32 @get_ival(i8* %0, i32 1, i32 %14, i32 %7, i32* %5)
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %4
ret void
}