#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(char *);
char *read_line(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ split_string_and_return_specific_index(char *, char *, int,
                                                          int);
void get_integers_from_column_in_vcf(FILE *vcf_file_pointer,
                                     int *integer_values, int number_of_snps,
                                     int column_number) {
  rewind(vcf_file_pointer);
  char *szBuffer;
  szBuffer = (char *)calloc(65536, sizeof(char));
  int reference_index = 0;
  char result[1000] = {0};
  do {
    szBuffer[0] = '\0';
    szBuffer = read_line(szBuffer, vcf_file_pointer);
    if (szBuffer[0] == '\0') {
      break;
    }
    if (szBuffer[0] != '#') {
      split_string_and_return_specific_index(result, szBuffer, column_number,
                                             100000);
      integer_values[reference_index] = atoi(result);
      reference_index++;
    }
  } while (szBuffer[0] != '\0');
  free(szBuffer);
}


x86 assembly (clang, -O0):
<get_integers_from_column_in_vcf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
mov    $0x10000,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1050 <memset@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <read_line@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11ec <get_integers_from_column_in_vcf+0x7c>
jmp    124b <get_integers_from_column_in_vcf+0xdb>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     1236 <get_integers_from_column_in_vcf+0xc6>
lea    -0x410(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x186a0,%ecx
call   1090 <split_string_and_return_specific_index@plt>
lea    -0x410(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    123b <get_integers_from_column_in_vcf+0xcb>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11bf <get_integers_from_column_in_vcf+0x4f>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_integers_from_column_in_vcf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3e8,%rsp
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%r13
call   1040 <rewind@plt>
mov    $0x10000,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
mov    %rsp,%r12
xor    %ebp,%ebp
mov    $0x3e8,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
jmp    11c4 <get_integers_from_column_in_vcf+0x54>
nopw   0x0(%rax,%rax,1)
test   %al,%al
je     120a <get_integers_from_column_in_vcf+0x9a>
movb   $0x0,(%rbx)
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <read_line@plt>
mov    %rax,%rbx
movzbl (%rax),%eax
cmp    $0x23,%al
je     11c0 <get_integers_from_column_in_vcf+0x50>
test   %al,%al
je     120a <get_integers_from_column_in_vcf+0x9a>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    $0x186a0,%ecx
call   1090 <split_string_and_return_specific_index@plt>
mov    %r12,%rdi
call   1080 <atoi@plt>
movslq %ebp,%rbp
mov    %eax,(%r15,%rbp,4)
add    $0x1,%ebp
movzbl (%rbx),%eax
jmp    11c0 <get_integers_from_column_in_vcf+0x50>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_integers_from_column_in_vcf(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [1000 x i8]
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32*, i32** %5
%13 = call i32 @rewind(i32* %12)
%14 = call i64 @calloc(i32 65536, i32 1)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %9
store i32 0, i32* %10
%16 = bitcast [1000 x i8]* %11 to i8*
br label %17
17: ; preds = %49, %4
%18 = load i8*, i8** %9
%19 = getelementptr inbounds i8, i8* %18, i64 0
store i8 0, i8* %19
%20 = load i8*, i8** %9
%21 = load i32*, i32** %5
%22 = call i8* @read_line(i8* %20, i32* %21)
store i8* %22, i8** %9
%23 = load i8*, i8** %9
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %17
br label %55
29: ; preds = %17
%30 = load i8*, i8** %9
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 35
br i1 %34, label %35, label %48
35: ; preds = %29
%36 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%37 = load i8*, i8** %9
%38 = load i32, i32* %8
%39 = call i32 @split_string_and_return_specific_index(i8* %36, i8* %37, i32 %38, i32 100000)
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%41 = call i32 @atoi(i8* %40)
%42 = load i32*, i32** %6
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
store i32 %41, i32* %45
%46 = load i32, i32* %10
%47 = add nsw i32 %46, 1
store i32 %47, i32* %10
br label %48
48: ; preds = %35, %29
br label %49
49: ; preds = %48
%50 = load i8*, i8** %9
%51 = getelementptr inbounds i8, i8* %50, i64 0
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp ne i32 %53, 0
br i1 %54, label %17, label %55
55: ; preds = %49, %28
%56 = load i8*, i8** %9
%57 = call i32 @free(i8* %56)
ret void
}

LLVM IR (-O2):
define void @get_integers_from_column_in_vcf(i32* %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = alloca [1000 x i8]
%6 = tail call i32 @rewind(i32* %0)
%7 = tail call i64 @calloc(i32 65536, i32 1)
%8 = inttoptr i64 %7 to i8*
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
br label %10
10: ; preds = %22, %4
%11 = phi i8* [ %8, %4 ], [ %13, %22 ]
%12 = phi i32 [ 0, %4 ], [ %24, %22 ]
store i8 0, i8* %11
%13 = call i8* @read_line(i8* %11, i32* %0)
%14 = load i8, i8* %13
switch i8 %14, label %15 [
i8 0, label %26
i8 35, label %22
]
15: ; preds = %10
%16 = call i32 @split_string_and_return_specific_index(i8* %9, i8* %13, i32 %3, i32 100000)
%17 = call i32 @atoi(i8* %9)
%18 = sext i32 %12 to i64
%19 = getelementptr inbounds i32, i32* %1, i64 %18
store i32 %17, i32* %19
%20 = add nsw i32 %12, 1
%21 = load i8, i8* %13
br label %22
22: ; preds = %10, %15
%23 = phi i8 [ %14, %10 ], [ %21, %15 ]
%24 = phi i32 [ %12, %10 ], [ %20, %15 ]
%25 = icmp eq i8 %23, 0
br i1 %25, label %26, label %10
26: ; preds = %10, %22
%27 = call i32 @free(i8* %13)
ret void
}