#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 /*<<< orphan*/ EXIT_FAILURE;
char *alternative_bases(char, char *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char *format_alternative_bases(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ output_vcf_row_samples_bases(int /*<<< orphan*/ *, char,
                                                char *, char *, int);
int /*<<< orphan*/ stderr;
void output_vcf_row(FILE *vcf_file_pointer, char *bases_for_snp,
                    int snp_location, int number_of_samples,
                    char pseudo_reference_sequence[]) {
  char reference_base = pseudo_reference_sequence[snp_location];
  if (reference_base == '\0') {
    fprintf(stderr, "Couldnt get the reference base for coordinate %d\n",
            snp_location);
    fflush(stderr);
    exit(EXIT_FAILURE);
  }
  fprintf(vcf_file_pointer, "1\t");
  fprintf(vcf_file_pointer, "%d\t", (int)snp_location + 1);
  fprintf(vcf_file_pointer, ".\t");
  fprintf(vcf_file_pointer, "%c\t", (char)reference_base);
  char *alt_bases =
      alternative_bases(reference_base, bases_for_snp, number_of_samples);
  char *alternative_bases_string = format_alternative_bases(alt_bases);
  fprintf(vcf_file_pointer, "%s\t", alternative_bases_string);
  free(alternative_bases_string);
  fprintf(vcf_file_pointer, ".\t");
  fprintf(vcf_file_pointer, ".\t");
  fprintf(vcf_file_pointer, ".\t");
  fprintf(vcf_file_pointer, "GT\t");
  output_vcf_row_samples_bases(vcf_file_pointer, reference_base, alt_bases,
                               bases_for_snp, number_of_samples);
  free(alt_bases);
  fprintf(vcf_file_pointer, "\n");
}


x86 assembly (clang, -O0):
<output_vcf_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x0,%eax
jne    11dc <output_vcf_row+0x6c>
mov    0x2e34(%rip),%rax
movslq (%rax),%rdi
mov    -0x14(%rbp),%edx
lea    0xe47(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movsbl -0x21(%rbp),%edx
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x21(%rbp),%al
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
movsbl %al,%edi
call   1040 <alternative_bases@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1070 <format_alternative_bases@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x21(%rbp),%al
mov    -0x30(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8d
movsbl %al,%esi
call   1090 <output_vcf_row_samples_bases@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
lea    0xd49(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_vcf_row>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
movslq %edx,%rax
movsbl (%r8,%rax,1),%r12d
test   %r12d,%r12d
je     12e4 <output_vcf_row+0x154>
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe74(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
add    $0x1,%ebp
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xe4c(%rip),%r13
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
lea    0xe33(%rip),%rsi
mov    %rbx,%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r12d,%edi
mov    %r15,%rsi
mov    %r14d,%edx
call   1040 <alternative_bases@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <format_alternative_bases@plt>
mov    %r14d,0x4(%rsp)
mov    %rax,%r14
lea    0xe02(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
lea    0xdab(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    0x4(%rsp),%r8d
call   10b0 <output_vcf_row_samples_bases@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fputc@plt>
mov    0x2cf5(%rip),%rbx
movslq (%rbx),%rdi
lea    0xd0b(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
call   1070 <fflush@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Couldnt get the reference base for coordinate %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"1\09\00"
@.str.2 = [4 x i8] c"%d\09\00"
@.str.3 = [3 x i8] c".\09\00"
@.str.4 = [4 x i8] c"%c\09\00"
@.str.5 = [4 x i8] c"%s\09\00"
@.str.6 = [4 x i8] c"GT\09\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @output_vcf_row(i32* %0, i8* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8
%12 = alloca i8*
%13 = alloca i8*
store i32* %0, i32** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%14 = load i8*, i8** %10
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
store i8 %18, i8* %11
%19 = load i8, i8* %11
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %5
%23 = load i32, i32* @stderr
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load i32, i32* %8
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @stderr
%29 = call i32 @fflush(i32 %28)
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %5
%33 = load i32*, i32** %6
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32*, i32** %6
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = load i32*, i32** %6
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%41 = load i32*, i32** %6
%42 = load i8, i8* %11
%43 = sext i8 %42 to i32
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i8, i8* %11
%46 = load i8*, i8** %7
%47 = load i32, i32* %9
%48 = call i8* @alternative_bases(i8 signext %45, i8* %46, i32 %47)
store i8* %48, i8** %12
%49 = load i8*, i8** %12
%50 = call i8* @format_alternative_bases(i8* %49)
store i8* %50, i8** %13
%51 = load i32*, i32** %6
%52 = load i8*, i8** %13
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %52)
%54 = load i8*, i8** %13
%55 = call i32 @free(i8* %54)
%56 = load i32*, i32** %6
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32*, i32** %6
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%60 = load i32*, i32** %6
%61 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%62 = load i32*, i32** %6
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%64 = load i32*, i32** %6
%65 = load i8, i8* %11
%66 = load i8*, i8** %12
%67 = load i8*, i8** %7
%68 = load i32, i32* %9
%69 = call i32 @output_vcf_row_samples_bases(i32* %64, i8 signext %65, i8* %66, i8* %67, i32 %68)
%70 = load i8*, i8** %12
%71 = call i32 @free(i8* %70)
%72 = load i32*, i32** %6
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Couldnt get the reference base for coordinate %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"1\09\00"
@.str.2 = [4 x i8] c"%d\09\00"
@.str.3 = [3 x i8] c".\09\00"
@.str.4 = [4 x i8] c"%c\09\00"
@.str.5 = [4 x i8] c"%s\09\00"
@.str.6 = [4 x i8] c"GT\09\00"
define void @output_vcf_row(i32* %0, i8* %1, i32 %2, i32 %3, i8* nocapture %4) {
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %5
%11 = load i32, i32* @stderr
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %2)
%15 = load i32, i32* @stderr
%16 = tail call i32 @fflush(i32 %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %5
%20 = sext i8 %8 to i32
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %0)
%22 = add nsw i32 %2, 1
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
%25 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%26 = tail call i8* @alternative_bases(i8 signext %8, i8* %1, i32 %3)
%27 = tail call i8* @format_alternative_bases(i8* %26)
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %27)
%29 = tail call i32 @free(i8* %27)
%30 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
%32 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
%33 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3, i64 1, i32* %0)
%34 = tail call i32 @output_vcf_row_samples_bases(i32* %0, i8 signext %8, i8* %26, i8* %1, i32 %3)
%35 = tail call i32 @free(i8* %26)
%36 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}