#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__ EOF;
int /*<<< orphan*/ exiterror(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
void Look_for_format(FILE *fp, char *format) {
  char stringa[200];
  format[0] = 0;
  do {
    if (fscanf(fp, "%s", stringa) == EOF)
      exiterror("input file not in a known", " format");
    if (stringa[0] == '>')
      strcpy(format, "B");
    if (stringa[0] == ';')
      strcpy(format, "I");
    if (strncmp(stringa, "ID", 2) == 0)
      strcpy(format, "EMBL");
    if (strncmp(stringa, "LOCUS", 2) == 0)
      strcpy(format, "GB");
  } while (!format[0]);
  rewind(fp);
  return;
}


x86 assembly (clang, -O0):
<Look_for_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0xe0(%rbp),%rdx
lea    0xe84(%rip),%rsi
call   1070 <fscanf@plt>
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%rax
jne    11a4 <Look_for_format+0x54>
lea    0xe6b(%rip),%rdi
lea    0xe7e(%rip),%rsi
call   1040 <exiterror@plt>
movsbl -0xe0(%rbp),%eax
cmp    $0x3e,%eax
jne    11c4 <Look_for_format+0x74>
mov    -0x10(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1050 <strcpy@plt>
movsbl -0xe0(%rbp),%eax
cmp    $0x3b,%eax
jne    11e4 <Look_for_format+0x94>
mov    -0x10(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1050 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe35(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1216 <Look_for_format+0xc6>
mov    -0x10(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   1050 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe0b(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1248 <Look_for_format+0xf8>
mov    -0x10(%rbp),%rdi
lea    0xdf2(%rip),%rsi
call   1050 <strcpy@plt>
jmp    124d <Look_for_format+0xfd>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    116a <Look_for_format+0x1a>
mov    -0x8(%rbp),%rdi
call   1060 <rewind@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Look_for_format>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movb   $0x0,(%rsi)
mov    %rsp,%r12
mov    0x2e74(%rip),%r15
lea    0xeac(%rip),%r13
lea    0xead(%rip),%rbp
jmp    1199 <Look_for_format+0x49>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,(%rbx)
jne    1242 <Look_for_format+0xf2>
mov    %r14,%rdi
lea    0xe5d(%rip),%rsi
mov    %r12,%rdx
call   1070 <fscanf@plt>
cmp    (%r15),%rax
jne    11c3 <Look_for_format+0x73>
lea    0xe4c(%rip),%rdi
lea    0xe5f(%rip),%rsi
call   1040 <exiterror@plt>
movzbl (%rsp),%eax
cmp    $0x3e,%al
jne    11de <Look_for_format+0x8e>
mov    %rbx,%rdi
lea    0xe61(%rip),%rsi
call   1050 <strcpy@plt>
movzbl (%rsp),%eax
cmp    $0x3b,%al
jne    11f1 <Look_for_format+0xa1>
mov    %rbx,%rdi
lea    0xe39(%rip),%rsi
call   1050 <strcpy@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1215 <Look_for_format+0xc5>
mov    %rbx,%rdi
lea    0xe1a(%rip),%rsi
call   1050 <strcpy@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1190 <Look_for_format+0x40>
mov    %rbx,%rdi
lea    0xdfd(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1190 <Look_for_format+0x40>
mov    %r14,%rdi
call   1060 <rewind@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [26 x i8] c"input file not in a known\00"
@.str.2 = [8 x i8] c" format\00"
@.str.3 = [2 x i8] c"B\00"
@.str.4 = [2 x i8] c"I\00"
@.str.5 = [3 x i8] c"ID\00"
@.str.6 = [5 x i8] c"EMBL\00"
@.str.7 = [6 x i8] c"LOCUS\00"
@.str.8 = [3 x i8] c"GB\00"
define void @Look_for_format(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [200 x i8]
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 0, i8* %7
br label %8
8: ; preds = %47, %2
%9 = load i32*, i32** %3
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%11 = call i64 @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 @exiterror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 62
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i8*, i8** %4
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %21, %16
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 59
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = load i8*, i8** %4
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %29, %24
%33 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%34 = call i64 @strncmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = call i32 @strcpy(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %39
39: ; preds = %36, %32
%40 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%41 = call i64 @strncmp(i8* %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 2)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i8*, i8** %4
%45 = call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %46
46: ; preds = %43, %39
br label %47
47: ; preds = %46
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i64 0
%50 = load i8, i8* %49
%51 = icmp ne i8 %50, 0
%52 = xor i1 %51, true
br i1 %52, label %8, label %53
53: ; preds = %47
%54 = load i32*, i32** %3
%55 = call i32 @rewind(i32* %54)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [26 x i8] c"input file not in a known\00"
@.str.2 = [8 x i8] c" format\00"
@.str.3 = [2 x i8] c"B\00"
@.str.4 = [2 x i8] c"I\00"
@.str.5 = [3 x i8] c"ID\00"
@.str.6 = [5 x i8] c"EMBL\00"
@.str.7 = [6 x i8] c"LOCUS\00"
@.str.8 = [3 x i8] c"GB\00"
define void @Look_for_format(i32* nocapture %0, i8* %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
store i8 0, i8* %1
br label %5
5: ; preds = %32, %2
%6 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @exiterror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
%12 = load i8, i8* %4
%13 = icmp eq i8 %12, 62
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = load i8, i8* %4
br label %17
17: ; preds = %14, %11
%18 = phi i8 [ %16, %14 ], [ %12, %11 ]
%19 = icmp eq i8 %18, 59
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 2)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %32
32: ; preds = %27, %30
%33 = load i8, i8* %1
%34 = icmp eq i8 %33, 0
br i1 %34, label %5, label %35
35: ; preds = %32
%36 = call i32 @rewind(i32* %0)
ret void
}