#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
void read_line_ancestrymap(char *szbuff, int *allele, char *name, int i, int j,
                           char *input, int *warning) {
  char *token;
  token = strtok(szbuff, " \t\n");
  if (token) {
    strcpy(name, token);
    token = strtok(NULL, " \t\n");
    if (token) {
      token = strtok(NULL, " \t\n");
      if (token) {
        *allele = (int)atoi(token);
      } else {
        printf("Error while reading %s file at individual %d,"
               " SNP %d.\n\n",
               input, i, j);
        exit(1);
      }
    } else {
      printf("Error while reading %s file at individual %d,"
             " SNP %d.\n\n",
             input, i, j);
      exit(1);
    }
  } else {
    printf("Error while reading %s file at individual %d,"
           " SNP %d.\n\n",
           input, i, j);
    exit(1);
  }
  if (!(*warning) && *allele != 9 && *allele != 1 && *allele != 2 &&
      *allele != 0) {
    printf("Warning: some genotypes are not 0, 1, 2 or 9 in %s.\n", input);
    printf("\t First warning at individual %d, column %d.\n\n", j, i);
    *warning = 1;
  }
}


x86 assembly (clang, -O0):
<read_line_ancestrymap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1241 <read_line_ancestrymap+0xf1>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe56(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     121a <read_line_ancestrymap+0xca>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe37(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11f3 <read_line_ancestrymap+0xa3>
mov    -0x30(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1215 <read_line_ancestrymap+0xc5>
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    123c <read_line_ancestrymap+0xec>
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    1263 <read_line_ancestrymap+0x113>
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    12d4 <read_line_ancestrymap+0x184>
mov    -0x10(%rbp),%rax
cmpl   $0x9,(%rax)
je     12d4 <read_line_ancestrymap+0x184>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
je     12d4 <read_line_ancestrymap+0x184>
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
je     12d4 <read_line_ancestrymap+0x184>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     12d4 <read_line_ancestrymap+0x184>
mov    -0x28(%rbp),%rsi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_line_ancestrymap>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9,%r12
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %rsi,%rbp
lea    0xe92(%rip),%rsi
call   1050 <strtok@plt>
test   %rax,%rax
je     1205 <read_line_ancestrymap+0xb5>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xe72(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
test   %rax,%rax
je     1205 <read_line_ancestrymap+0xb5>
lea    0xe5f(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
test   %rax,%rax
je     1205 <read_line_ancestrymap+0xb5>
mov    0x30(%rsp),%rbx
mov    %rax,%rdi
call   1060 <atoi@plt>
mov    %eax,0x0(%rbp)
cmpl   $0x0,(%rbx)
jne    11fc <read_line_ancestrymap+0xac>
cmp    $0x9,%eax
ja     11d1 <read_line_ancestrymap+0x81>
mov    $0x207,%ecx
bt     %eax,%ecx
jb     11fc <read_line_ancestrymap+0xac>
lea    0xe64(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x1,(%rbx)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdf8(%rip),%rdi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" \09\0A\00"
@.str.1 = [56 x i8] c"Error while reading %s file at individual %d, SNP %d.\0A\0A\00"
@.str.2 = [53 x i8] c"Warning: some genotypes are not 0, 1, 2 or 9 in %s.\0A\00"
@.str.3 = [47 x i8] c"\09 First warning at individual %d, column %d.\0A\0A\00"
define void @read_line_ancestrymap(i8* %0, i32* %1, i8* %2, i32 %3, i32 %4, i8* %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32*
%15 = alloca i8*
store i8* %0, i8** %8
store i32* %1, i32** %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i8* %5, i8** %13
store i32* %6, i32** %14
%16 = load i8*, i8** %8
%17 = call i8* @strtok(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %15
%18 = load i8*, i8** %15
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %50
20: ; preds = %7
%21 = load i8*, i8** %10
%22 = load i8*, i8** %15
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %24, i8** %15
%25 = load i8*, i8** %15
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %43
27: ; preds = %20
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %28, i8** %15
%29 = load i8*, i8** %15
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load i8*, i8** %15
%33 = call i64 @atoi(i8* %32)
%34 = trunc i64 %33 to i32
%35 = load i32*, i32** %9
store i32 %34, i32* %35
br label %42
36: ; preds = %27
%37 = load i8*, i8** %13
%38 = load i32, i32* %11
%39 = load i32, i32* %12
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %37, i32 %38, i32 %39)
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %31
br label %49
43: ; preds = %20
%44 = load i8*, i8** %13
%45 = load i32, i32* %11
%46 = load i32, i32* %12
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %44, i32 %45, i32 %46)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %42
br label %56
50: ; preds = %7
%51 = load i8*, i8** %13
%52 = load i32, i32* %11
%53 = load i32, i32* %12
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %51, i32 %52, i32 %53)
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %49
%57 = load i32*, i32** %14
%58 = load i32, i32* %57
%59 = icmp ne i32 %58, 0
br i1 %59, label %83, label %60
60: ; preds = %56
%61 = load i32*, i32** %9
%62 = load i32, i32* %61
%63 = icmp ne i32 %62, 9
br i1 %63, label %64, label %83
64: ; preds = %60
%65 = load i32*, i32** %9
%66 = load i32, i32* %65
%67 = icmp ne i32 %66, 1
br i1 %67, label %68, label %83
68: ; preds = %64
%69 = load i32*, i32** %9
%70 = load i32, i32* %69
%71 = icmp ne i32 %70, 2
br i1 %71, label %72, label %83
72: ; preds = %68
%73 = load i32*, i32** %9
%74 = load i32, i32* %73
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %83
76: ; preds = %72
%77 = load i8*, i8** %13
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %77)
%79 = load i32, i32* %12
%80 = load i32, i32* %11
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %79, i32 %80)
%82 = load i32*, i32** %14
store i32 1, i32* %82
br label %83
83: ; preds = %76, %72, %68, %64, %60, %56
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \09\0A\00"
@.str.1 = [56 x i8] c"Error while reading %s file at individual %d, SNP %d.\0A\0A\00"
@.str.2 = [53 x i8] c"Warning: some genotypes are not 0, 1, 2 or 9 in %s.\0A\00"
@.str.3 = [47 x i8] c"\09 First warning at individual %d, column %d.\0A\0A\00"
define void @read_line_ancestrymap(i8* %0, i32* nocapture writeonly %1, i8* %2, i32 %3, i32 %4, i8* %5, i32* nocapture %6) {
%8 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %30, label %10
10: ; preds = %7
%11 = tail call i32 @strcpy(i8* %2, i8* %8)
%12 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %27, label %14
14: ; preds = %10
%15 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %24, label %17
17: ; preds = %14
%18 = tail call i64 @atoi(i8* %15)
%19 = trunc i64 %18 to i32
store i32 %19, i32* %1
%20 = load i32, i32* %6
%21 = freeze i32 %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %36
23: ; preds = %17
switch i32 %19, label %33 [
i32 9, label %36
i32 2, label %36
i32 1, label %36
i32 0, label %36
]
24: ; preds = %14
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %3, i32 %4)
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %10
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %3, i32 %4)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %7
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %3, i32 %4)
%32 = tail call i32 @exit(i32 1)
unreachable
33: ; preds = %23
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %4, i32 %3)
store i32 1, i32* %6
br label %36
36: ; preds = %23, %23, %23, %23, %17, %33
ret void
}