#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 */
struct cond {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ get_word(char *, char *);
char *malloc(scalar_t__);
int read_file(char *, struct cond **);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int include_file(char *line, struct cond **template) {
  char *word = NULL, *ptr;
  int result;
  word = malloc(strlen(line) + 1);
  get_word(line, word);
  ptr = word;
  if (!strncmp(ptr, "sound/", 6))
    ptr += 6;
  if (!strncmp(ptr, "oss/", 4))
    return 0;
  result = read_file(ptr, template);
  free(word);
  return result;
}


x86 assembly (clang, -O0):
<include_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <get_word@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x6,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    11d0 <include_file+0x70>
mov    -0x28(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe2c(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    11fa <include_file+0x9a>
movl   $0x0,-0x4(%rbp)
jmp    1219 <include_file+0xb9>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <read_file@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<include_file>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <get_word@plt>
lea    0xe72(%rip),%rsi
mov    %r15,%rdi
mov    $0x6,%edx
call   1040 <strncmp@plt>
lea    0x6(%r15),%rbx
test   %eax,%eax
cmovne %r15,%rbx
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     11d6 <include_file+0x76>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <read_file@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
jmp    11d8 <include_file+0x78>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.cond = type { i32 }
@.str = [7 x i8] c"sound/\00"
@.str.1 = [5 x i8] c"oss/\00"
define i32 @include_file(i8* %0, %struct.cond** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.cond**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store %struct.cond** %1, %struct.cond*** %5
store i8* null, i8** %6
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %10, 1
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %6
%13 = load i8*, i8** %4
%14 = load i8*, i8** %6
%15 = call i32 @get_word(i8* %13, i8* %14)
%16 = load i8*, i8** %6
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = call i32 @strncmp(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%19 = icmp ne i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %2
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 6
store i8* %22, i8** %7
br label %23
23: ; preds = %20, %2
%24 = load i8*, i8** %7
%25 = call i32 @strncmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %23
store i32 0, i32* %3
br label %35
28: ; preds = %23
%29 = load i8*, i8** %7
%30 = load %struct.cond**, %struct.cond*** %5
%31 = call i32 @read_file(i8* %29, %struct.cond** %30)
store i32 %31, i32* %8
%32 = load i8*, i8** %6
%33 = call i32 @free(i8* %32)
%34 = load i32, i32* %8
store i32 %34, i32* %3
br label %35
35: ; preds = %28, %27
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
%struct.cond = type { i32 }
@.str = [7 x i8] c"sound/\00"
@.str.1 = [5 x i8] c"oss/\00"
define i32 @include_file(i8* %0, %struct.cond** %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add nsw i64 %3, 1
%5 = tail call i8* @malloc(i64 %4)
%6 = tail call i32 @get_word(i8* %0, i8* %5)
%7 = tail call i32 @strncmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i64 6, i64 0
%10 = getelementptr i8, i8* %5, i64 %9
%11 = tail call i32 @strncmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %2
%14 = tail call i32 @read_file(i8* %10, %struct.cond** %1)
%15 = tail call i32 @free(i8* %5)
br label %16
16: ; preds = %2, %13
%17 = phi i32 [ %14, %13 ], [ 0, %2 ]
ret i32 %17
}