#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*/ fprintf(int /*<<< orphan*/ *, char *, char *);
char *get_arg(int *, char *);
int /*<<< orphan*/ reset_args();
int strlen(char *);
void OutputUserSpecIncludes(FILE *fp) {
  char *arg, ch;
  int flag = 0;
  reset_args();
  arg = get_arg(&flag, &ch);
  while ((arg = get_arg(&flag, &ch)) != NULL) {
    if (flag) {
    } else {
      if ((strlen(arg) > 2) && (arg[(strlen(arg) - 2)] == '.') &&
          (arg[(strlen(arg) - 1)] == 'h')) {
        fprintf(fp, "#include \"%s\"\n", arg);
      }
    }
  }
}


x86 assembly (clang, -O0):
<OutputUserSpecIncludes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1060 <reset_args@plt>
lea    -0x18(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <get_arg@plt>
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <get_arg@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1219 <OutputUserSpecIncludes+0xd9>
cmpl   $0x0,-0x18(%rbp)
je     1195 <OutputUserSpecIncludes+0x55>
jmp    1214 <OutputUserSpecIncludes+0xd4>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jle    120f <OutputUserSpecIncludes+0xcf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    120f <OutputUserSpecIncludes+0xcf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x68,%eax
jne    120f <OutputUserSpecIncludes+0xcf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xdf6(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1214 <OutputUserSpecIncludes+0xd4>
jmp    116b <OutputUserSpecIncludes+0x2b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OutputUserSpecIncludes>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
call   1060 <reset_args@plt>
lea    0xc(%rsp),%rbx
lea    0xb(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <get_arg@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <get_arg@plt>
test   %rax,%rax
je     11f9 <OutputUserSpecIncludes+0xb9>
mov    %rax,%rbx
lea    0xe72(%rip),%r14
lea    0xc(%rsp),%r12
lea    0xb(%rsp),%r13
jmp    11b3 <OutputUserSpecIncludes+0x73>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <get_arg@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11f9 <OutputUserSpecIncludes+0xb9>
cmpl   $0x0,0xc(%rsp)
jne    11a0 <OutputUserSpecIncludes+0x60>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jl     11a0 <OutputUserSpecIncludes+0x60>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x2e,-0x2(%rax,%rbx,1)
jne    11a0 <OutputUserSpecIncludes+0x60>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x68,-0x1(%rax,%rbx,1)
jne    11a0 <OutputUserSpecIncludes+0x60>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
jmp    11a0 <OutputUserSpecIncludes+0x60>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"#include \22%s\22\0A\00"
define void @OutputUserSpecIncludes(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %5
%6 = call i32 (...) @reset_args()
%7 = call i8* @get_arg(i32* %5, i8* %4)
store i8* %7, i8** %3
br label %8
8: ; preds = %44, %1
%9 = call i8* @get_arg(i32* %5, i8* %4)
store i8* %9, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %45
11: ; preds = %8
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %44
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32 @strlen(i8* %16)
%18 = icmp sgt i32 %17, 2
br i1 %18, label %19, label %43
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = load i8*, i8** %3
%22 = call i32 @strlen(i8* %21)
%23 = sub nsw i32 %22, 2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %20, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 46
br i1 %28, label %29, label %43
29: ; preds = %19
%30 = load i8*, i8** %3
%31 = load i8*, i8** %3
%32 = call i32 @strlen(i8* %31)
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %30, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 104
br i1 %38, label %39, label %43
39: ; preds = %29
%40 = load i32*, i32** %2
%41 = load i8*, i8** %3
%42 = call i32 @fprintf(i32* %40, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %39, %29, %19, %15
br label %44
44: ; preds = %43, %14
br label %8
45: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"#include \22%s\22\0A\00"
define void @OutputUserSpecIncludes(i32* nocapture %0) {
%2 = alloca i8
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 (...) @reset_args()
%6 = call i8* @get_arg(i32* %3, i8* %2)
%7 = call i8* @get_arg(i32* %3, i8* %2)
%8 = icmp eq i8* %7, null
br i1 %8, label %35, label %9
9: ; preds = %1, %32
%10 = phi i8* [ %33, %32 ], [ %7, %1 ]
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %9
%14 = call i32 @strlen(i8* %10)
%15 = icmp sgt i32 %14, 2
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = call i32 @strlen(i8* %10)
%18 = add nsw i32 %17, -2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %10, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 46
br i1 %22, label %23, label %32
23: ; preds = %16
%24 = call i32 @strlen(i8* %10)
%25 = add nsw i32 %24, -1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %10, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 104
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %32
32: ; preds = %13, %16, %23, %30, %9
%33 = call i8* @get_arg(i32* %3, i8* %2)
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %9
35: ; preds = %32, %1
ret void
}