#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 *);
scalar_t__ malloc(int);
int /*<<< orphan*/ remove_leading_white_space(char *);
char **split_by_space(char *, int /*<<< orphan*/ *);
char *strdup(char *);
int *extract_coulmn_integer(char *str, int col_min, int col_max) {
  int *data = NULL;
  char *buffer = NULL, **str_data = NULL;
  int size = (col_max - col_min) + 1;
  int i = 0, n = 0;
  buffer = strdup(str);
  remove_leading_white_space(buffer);
  str_data = split_by_space(buffer, NULL);
  data = (int *)malloc(sizeof(int) * size);
  for (i = (col_min - 1); i < col_max; i++) {
    data[n] = atoi(str_data[i]);
    n++;
  }
  return data;
}


x86 assembly (clang, -O0):
<extract_coulmn_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <remove_leading_white_space@plt>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <split_by_space@plt>
mov    %rax,-0x28(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1218 <extract_coulmn_integer+0xc8>
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11d7 <extract_coulmn_integer+0x87>
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_coulmn_integer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
mov    %esi,%r14d
call   1070 <strdup@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1030 <remove_leading_white_space@plt>
mov    %rbp,%rdi
xor    %esi,%esi
call   1040 <split_by_space@plt>
mov    %rax,%r15
mov    %r12d,%eax
sub    %r14d,%eax
lea    0x4(,%rax,4),%edi
call   1050 <malloc@plt>
mov    %rax,%r13
sub    %r14d,%r12d
jl     11c7 <extract_coulmn_integer+0x77>
add    $0xffffffff,%r14d
movslq %r14d,%rax
add    $0x1,%r12d
lea    (%r15,%rax,8),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rdi
call   1060 <atoi@plt>
mov    %eax,0x0(%r13,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11b0 <extract_coulmn_integer+0x60>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @extract_coulmn_integer(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32* null, i32** %7
store i8* null, i8** %8
store i8** null, i8*** %9
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%17 = load i8*, i8** %4
%18 = call i8* @strdup(i8* %17)
store i8* %18, i8** %8
%19 = load i8*, i8** %8
%20 = call i32 @remove_leading_white_space(i8* %19)
%21 = load i8*, i8** %8
%22 = call i8** @split_by_space(i8* %21, i32* null)
store i8** %22, i8*** %9
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = mul i64 4, %24
%26 = trunc i64 %25 to i32
%27 = call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i32*
store i32* %28, i32** %7
%29 = load i32, i32* %5
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %11
br label %31
31: ; preds = %48, %3
%32 = load i32, i32* %11
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %51
35: ; preds = %31
%36 = load i8**, i8*** %9
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
%42 = load i32*, i32** %7
%43 = load i32, i32* %12
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
store i32 %41, i32* %45
%46 = load i32, i32* %12
%47 = add nsw i32 %46, 1
store i32 %47, i32* %12
br label %48
48: ; preds = %35
%49 = load i32, i32* %11
%50 = add nsw i32 %49, 1
store i32 %50, i32* %11
br label %31
51: ; preds = %31
%52 = load i32*, i32** %7
ret i32* %52
}

LLVM IR (-O2):
define i32* @extract_coulmn_integer(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %2, %1
%5 = tail call i8* @strdup(i8* %0)
%6 = tail call i32 @remove_leading_white_space(i8* %5)
%7 = tail call i8** @split_by_space(i8* %5, i32* null)
%8 = shl i32 %4, 2
%9 = add i32 %8, 4
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
%12 = icmp slt i32 %2, %1
br i1 %12, label %29, label %13
13: ; preds = %3
%14 = add i32 %1, -1
%15 = sext i32 %14 to i64
%16 = add i32 %2, 1
%17 = sub i32 %16, %1
%18 = zext i32 %17 to i64
br label %19
19: ; preds = %13, %19
%20 = phi i64 [ %15, %13 ], [ %27, %19 ]
%21 = phi i64 [ 0, %13 ], [ %26, %19 ]
%22 = getelementptr inbounds i8*, i8** %7, i64 %20
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = getelementptr inbounds i32, i32* %11, i64 %21
store i32 %24, i32* %25
%26 = add nuw nsw i64 %21, 1
%27 = add nsw i64 %20, 1
%28 = icmp eq i64 %26, %18
br i1 %28, label %29, label %19
29: ; preds = %19, %3
ret i32* %11
}