#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
void dumprequest(char *want, char *file, FILE *fp_out) {
  char buf[100];
  FILE *fp_in;
  if ((fp_in = fopen(file, "r")) != NULL) {
    while (fgets(buf, sizeof(buf), fp_in) != NULL)
      if (buf[0] == '@' && strncmp(want, &buf[1], strlen(want)) == 0) {
        while (fgets(buf, sizeof(buf), fp_in) != NULL)
          if (buf[0] == '#' || buf[0] == '%')
            continue;
          else if (buf[0] != '@')
            fprintf(fp_out, "%s", buf);
          else
            break;
      }
    fclose(fp_in);
  }
}


x86 assembly (clang, -O0):
<dumprequest>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
je     1299 <dumprequest+0x139>
jmp    119d <dumprequest+0x3d>
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     128d <dumprequest+0x12d>
movsbl -0x80(%rbp),%eax
cmp    $0x40,%eax
jne    1288 <dumprequest+0x128>
mov    -0x8(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x98(%rbp),%rdi
mov    -0x90(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1288 <dumprequest+0x128>
jmp    1210 <dumprequest+0xb0>
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1283 <dumprequest+0x123>
movsbl -0x80(%rbp),%eax
cmp    $0x23,%eax
je     1249 <dumprequest+0xe9>
movsbl -0x80(%rbp),%eax
cmp    $0x25,%eax
jne    124e <dumprequest+0xee>
jmp    1210 <dumprequest+0xb0>
movsbl -0x80(%rbp),%eax
cmp    $0x40,%eax
je     1274 <dumprequest+0x114>
mov    -0x18(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xd98(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1279 <dumprequest+0x119>
jmp    1283 <dumprequest+0x123>
jmp    127e <dumprequest+0x11e>
jmp    1210 <dumprequest+0xb0>
jmp    1288 <dumprequest+0x128>
jmp    119d <dumprequest+0x3d>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumprequest>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %rdx,%r14
mov    %rsi,%rax
mov    %rdi,%r15
lea    0xe83(%rip),%rsi
mov    %rax,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     123a <dumprequest+0xda>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x64,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1232 <dumprequest+0xd2>
lea    0x1(%rsp),%r12
mov    %rsp,%r13
jmp    11d5 <dumprequest+0x75>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    $0x64,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1232 <dumprequest+0xd2>
cmpb   $0x40,(%rsp)
jne    11c0 <dumprequest+0x60>
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11c0 <dumprequest+0x60>
jmp    120b <dumprequest+0xab>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
mov    %r13,%rdi
mov    $0x64,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     11c0 <dumprequest+0x60>
movzbl (%rsp),%eax
cmp    $0x23,%al
je     120b <dumprequest+0xab>
cmp    $0x25,%al
je     120b <dumprequest+0xab>
cmp    $0x40,%al
jne    1200 <dumprequest+0xa0>
jmp    11c0 <dumprequest+0x60>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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