#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(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  FILE *where, *from;
  char key[1024], data[1024];
  if ((where = fopen(argv[1], "r")) == NULL) {
    exit(1);
  }
  if ((from = fopen(argv[2], "r")) == NULL) {
    exit(2);
  }
  while (fgets(key, 1024, where) != 0) {
    while (fgets(data, 1024, from) != 0) {
      if (strncmp(key, data, 9) == 0) {
        printf("%s", data);
        break;
      } else {
        continue;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1195 <main+0x45>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe5c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11c1 <main+0x71>
mov    $0x2,%edi
call   1070 <exit@plt>
jmp    11c6 <main+0x76>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     124d <main+0xfd>
jmp    11ea <main+0x9a>
lea    -0x820(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1248 <main+0xf8>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1243 <main+0xf3>
lea    -0x820(%rbp),%rsi
lea    0xdc9(%rip),%rdi
call   1040 <printf@plt>
jmp    1248 <main+0xf8>
jmp    11ea <main+0x9a>
jmp    11c6 <main+0x76>
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe92(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     122f <main+0xdf>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe76(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1239 <main+0xe9>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     121c <main+0xcc>
lea    0x400(%rsp),%rbx
mov    %rsp,%r12
lea    0xe40(%rip),%r13
jmp    11f0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     121c <main+0xcc>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11db <main+0x8b>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11f0 <main+0xa0>
jmp    11d0 <main+0x80>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1070 <exit@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %6
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %7
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 @exit(i32 2)
unreachable
25: ; preds = %17
br label %26
26: ; preds = %46, %25
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%28 = load i32*, i32** %6
%29 = call i64 @fgets(i8* %27, i32 1024, i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %47
31: ; preds = %26
br label %32
32: ; preds = %45, %31
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%34 = load i32*, i32** %7
%35 = call i64 @fgets(i8* %33, i32 1024, i32* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %46
37: ; preds = %32
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%40 = call i64 @strncmp(i8* %38, i8* %39, i32 9)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%44 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %43)
br label %46
45: ; preds = %37
br label %32
46: ; preds = %42, %32
br label %26
47: ; preds = %26
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %21, label %18
18: ; preds = %13
%19 = call i64 @fgets(i8* %5, i32 1024, i32* %9)
%20 = icmp eq i64 %19, 0
br i1 %20, label %35, label %23
21: ; preds = %13
%22 = tail call i32 @exit(i32 2)
unreachable
23: ; preds = %18, %29
%24 = call i64 @fgets(i8* %6, i32 1024, i32* %16)
%25 = icmp eq i64 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = call i64 @strncmp(i8* %5, i8* %6, i32 9)
%28 = icmp eq i64 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %26, %32
br label %23
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %32
32: ; preds = %23, %30
%33 = call i64 @fgets(i8* %5, i32 1024, i32* %9)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %29
35: ; preds = %32, %18
ret i32 0
}