#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__ feof(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  if (argc < 3) {
    return 0;
  }
  FILE *qfile = fopen(argv[2], "r");
  if (qfile == NULL) {
    return 0;
  }
  char *ques = (char *)malloc(100);
  int line = 0;
  int siz, i, k;
  char *voc = (char *)malloc(2 * 5);
  while (feof(qfile) == 0) {
    ques = fgets(ques, 100, qfile);
    if (ques == NULL)
      break;
    line++;
    siz = strlen(ques) - 1;
    ques[siz] = '\0';
    if (strcmp(argv[1], ques) == 0)
      return line;
  }
  free(ques);
  free(voc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    119c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    128f <main+0x11f>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe55(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11cb <main+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    128f <main+0x11f>
mov    $0x64,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0xa,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
jne    1276 <main+0x106>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1227 <main+0xb7>
jmp    1276 <main+0x106>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1271 <main+0x101>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    128f <main+0x11f>
jmp    11ee <main+0x7e>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebp,%ebp
cmp    $0x3,%edi
jl     121e <main+0xae>
mov    %rsi,%r14
mov    0x10(%rsi),%rdi
lea    0xe6f(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     121e <main+0xae>
mov    %rax,%r12
mov    $0x64,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0xa,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    120c <main+0x9c>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     120a <main+0x9a>
mov    %rax,%rbx
add    $0x1,%ebp
mov    %rax,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    0x8(%r14),%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11c0 <main+0x50>
jmp    121e <main+0xae>
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 0, i32* %3
br label %64
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %20, i32** %6
%21 = load i32*, i32** %6
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 0, i32* %3
br label %64
24: ; preds = %16
%25 = call i64 @malloc(i32 100)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %7
store i32 0, i32* %8
%27 = call i64 @malloc(i32 10)
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %12
br label %29
29: ; preds = %58, %24
%30 = load i32*, i32** %6
%31 = call i64 @feof(i32* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %59
33: ; preds = %29
%34 = load i8*, i8** %7
%35 = load i32*, i32** %6
%36 = call i8* @fgets(i8* %34, i32 100, i32* %35)
store i8* %36, i8** %7
%37 = load i8*, i8** %7
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %40
39: ; preds = %33
br label %59
40: ; preds = %33
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
%43 = load i8*, i8** %7
%44 = call i32 @strlen(i8* %43)
%45 = sub nsw i32 %44, 1
store i32 %45, i32* %9
%46 = load i8*, i8** %7
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 0, i8* %49
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = load i8*, i8** %7
%54 = call i64 @strcmp(i8* %52, i8* %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %40
%57 = load i32, i32* %8
store i32 %57, i32* %3
br label %64
58: ; preds = %40
br label %29
59: ; preds = %39, %29
%60 = load i8*, i8** %7
%61 = call i32 @free(i8* %60)
%62 = load i8*, i8** %12
%63 = call i32 @free(i8* %62)
store i32 0, i32* %3
br label %64
64: ; preds = %59, %56, %23, %15
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %36, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %36, label %9
9: ; preds = %4
%10 = tail call i64 @malloc(i32 100)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i64 @malloc(i32 10)
%13 = inttoptr i64 %12 to i8*
%14 = getelementptr inbounds i8*, i8** %1, i64 1
br label %15
15: ; preds = %23, %9
%16 = phi i32 [ 0, %9 ], [ %24, %23 ]
%17 = phi i8* [ %11, %9 ], [ %21, %23 ]
%18 = tail call i64 @feof(i32* %7)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %15
%21 = tail call i8* @fgets(i8* %17, i32 100, i32* %7)
%22 = icmp eq i8* %21, null
br i1 %22, label %32, label %23
23: ; preds = %20
%24 = add nuw nsw i32 %16, 1
%25 = tail call i32 @strlen(i8* %21)
%26 = add nsw i32 %25, -1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %21, i64 %27
store i8 0, i8* %28
%29 = load i8*, i8** %14
%30 = tail call i64 @strcmp(i8* %29, i8* %21)
%31 = icmp eq i64 %30, 0
br i1 %31, label %36, label %15
32: ; preds = %20, %15
%33 = phi i8* [ null, %20 ], [ %17, %15 ]
%34 = tail call i32 @free(i8* %33)
%35 = tail call i32 @free(i8* %13)
br label %36
36: ; preds = %23, %4, %32, %2
%37 = phi i32 [ 0, %2 ], [ 0, %4 ], [ 0, %32 ], [ %24, %23 ]
ret i32 %37
}