#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 */
scalar_t__ calloc(int, int);
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_sequence_from_column_in_vcf(FILE *vcf_file_pointer,
                                     char *sequence_bases, 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,
                                             1000);
      sequence_bases[reference_index] = result[0];
      reference_index++;
    }
  } while (szBuffer[0] != '\0');
  sequence_bases[reference_index] = '\0';
}


x86 assembly (clang, -O0):
<get_sequence_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   1030 <rewind@plt>
mov    $0x10000,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <read_line@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11cc <get_sequence_from_column_in_vcf+0x7c>
jmp    1223 <get_sequence_from_column_in_vcf+0xd3>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     120e <get_sequence_from_column_in_vcf+0xbe>
lea    -0x410(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x3e8,%ecx
call   1070 <split_string_and_return_specific_index@plt>
mov    -0x410(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1213 <get_sequence_from_column_in_vcf+0xc3>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    119f <get_sequence_from_column_in_vcf+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x410,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @get_sequence_from_column_in_vcf(i32* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [1000 x i8]
store i32* %0, i32** %5
store i8* %1, i8** %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 1000)
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%41 = load i8, i8* %40
%42 = load i8*, i8** %6
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 %41, i8* %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** %6
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
store i8 0, i8* %59
ret void
}

LLVM IR (-O2):
define void @get_sequence_from_column_in_vcf(i32* %0, i8* 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 1000)
%17 = load i8, i8* %9
%18 = sext i32 %12 to i64
%19 = getelementptr inbounds i8, i8* %1, i64 %18
store i8 %17, i8* %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 = phi i32 [ %12, %10 ], [ %24, %22 ]
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %1, i64 %28
store i8 0, i8* %29
ret void
}