#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 */
char *format_allele_index(char, char, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
void output_vcf_row_samples_bases(FILE *vcf_file_pointer, char reference_base,
                                  char *alt_bases, char *bases_for_snp,
                                  int number_of_samples) {
  int i;
  char *format;
  for (i = 0; i < number_of_samples; i++) {
    format = format_allele_index(bases_for_snp[i], reference_base, alt_bases);
    fprintf(vcf_file_pointer, "%s", format);
    free(format);
    if (i + 1 != number_of_samples) {
      fprintf(vcf_file_pointer, "\t");
    }
  }
}


x86 assembly (clang, -O0):
<output_vcf_row_samples_bases>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11d5 <output_vcf_row_samples_bases+0xa5>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x9(%rbp),%al
mov    -0x18(%rbp),%rdx
movsbl %cl,%edi
movsbl %al,%esi
call   1040 <format_allele_index@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
cmp    -0x24(%rbp),%eax
je     11c2 <output_vcf_row_samples_bases+0x92>
mov    -0x8(%rbp),%rdi
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11c7 <output_vcf_row_samples_bases+0x97>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1155 <output_vcf_row_samples_bases+0x25>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_vcf_row_samples_bases>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %rdx,0x8(%rsp)
test   %r8d,%r8d
jle    11bc <output_vcf_row_samples_bases+0x7c>
mov    %rdi,%rbx
mov    %r8d,%r13d
lea    -0x1(%r13),%r14
xor    %ebp,%ebp
movsbl %sil,%r12d
jmp    1175 <output_vcf_row_samples_bases+0x35>
nop
cmp    %rbp,%r13
je     11bc <output_vcf_row_samples_bases+0x7c>
mov    %rbp,%r15
mov    0x10(%rsp),%rax
movsbl (%rax,%rbp,1),%edi
mov    %r12d,%esi
mov    0x8(%rsp),%rdx
call   1040 <format_allele_index@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
lea    0x1(%r15),%rbp
cmp    %r15,%r14
je     1170 <output_vcf_row_samples_bases+0x30>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
jmp    1170 <output_vcf_row_samples_bases+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"\09\00"
define void @output_vcf_row_samples_bases(i32* %0, i8 signext %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store i32* %0, i32** %6
store i8 %1, i8* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %13
13: ; preds = %39, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %10
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %42
17: ; preds = %13
%18 = load i8*, i8** %9
%19 = load i32, i32* %11
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = load i8, i8* %7
%24 = load i8*, i8** %8
%25 = call i8* @format_allele_index(i8 signext %22, i8 signext %23, i8* %24)
store i8* %25, i8** %12
%26 = load i32*, i32** %6
%27 = load i8*, i8** %12
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %12
%30 = call i32 @free(i8* %29)
%31 = load i32, i32* %11
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %10
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %17
%36 = load i32*, i32** %6
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %35, %17
br label %39
39: ; preds = %38
%40 = load i32, i32* %11
%41 = add nsw i32 %40, 1
store i32 %41, i32* %11
br label %13
42: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @output_vcf_row_samples_bases(i32* nocapture %0, i8 signext %1, i8* %2, i8* nocapture %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %22
7: ; preds = %5
%8 = zext i32 %4 to i64
br label %9
9: ; preds = %7, %20
%10 = phi i64 [ 0, %7 ], [ %16, %20 ]
%11 = getelementptr inbounds i8, i8* %3, i64 %10
%12 = load i8, i8* %11
%13 = tail call i8* @format_allele_index(i8 signext %12, i8 signext %1, i8* %2)
%14 = tail call i32 @fputs(i8* %13, i32* %0)
%15 = tail call i32 @free(i8* %13)
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %20, label %18
18: ; preds = %9
%19 = tail call i32 @fputc(i32 9, i32* %0)
br label %20
20: ; preds = %9, %18
%21 = icmp eq i64 %16, %8
br i1 %21, label %22, label %9
22: ; preds = %20, %5
ret void
}