#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 *);
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, num;
  buffer = strdup(str);
  remove_leading_white_space(buffer);
  str_data = split_by_space(buffer, &num);
  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
lea    -0x38(%rbp),%rsi
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>
lea    0x4(%rsp),%rsi
mov    %rbp,%rdi
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
%13 = 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
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = sub nsw i32 %14, %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%18 = load i8*, i8** %4
%19 = call i8* @strdup(i8* %18)
store i8* %19, i8** %8
%20 = load i8*, i8** %8
%21 = call i32 @remove_leading_white_space(i8* %20)
%22 = load i8*, i8** %8
%23 = call i8** @split_by_space(i8* %22, i32* %13)
store i8** %23, i8*** %9
%24 = load i32, i32* %10
%25 = sext i32 %24 to i64
%26 = mul i64 4, %25
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to i32*
store i32* %29, i32** %7
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %11
br label %32
32: ; preds = %49, %3
%33 = load i32, i32* %11
%34 = load i32, i32* %6
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %52
36: ; preds = %32
%37 = load i8**, i8*** %9
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
%43 = load i32*, i32** %7
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
store i32 %42, i32* %46
%47 = load i32, i32* %12
%48 = add nsw i32 %47, 1
store i32 %48, i32* %12
br label %49
49: ; preds = %36
%50 = load i32, i32* %11
%51 = add nsw i32 %50, 1
store i32 %51, i32* %11
br label %32
52: ; preds = %32
%53 = load i32*, i32** %7
ret i32* %53
}

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