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

/* Variables and functions */
scalar_t__ empty_line(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ parse_name(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
void print_subsys(char *file) {
  char line[256];
  FILE *fp = 0;
  parse_name(file);
  fp = fopen(file, "r");
  if (fp != NULL) {
    while (fgets(line, sizeof(line), fp) != NULL) {
      if (empty_line(line) == 0) {
        printf("  ");
        fputs(line, stdout);
      }
    }
    fclose(fp);
  } else {
    printf("Error opening '%s'\n", file);
  }
}


x86 assembly (clang, -O0):
<print_subsys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x118(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <parse_name@plt>
mov    -0x8(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
je     122e <print_subsys+0xbe>
jmp    11bd <print_subsys+0x4d>
lea    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%rdx
mov    $0x100,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     121d <print_subsys+0xad>
lea    -0x110(%rbp),%rdi
call   1090 <empty_line@plt>
cmp    $0x0,%rax
jne    1218 <print_subsys+0xa8>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
call   1060 <fputs@plt>
jmp    11bd <print_subsys+0x4d>
mov    -0x118(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1240 <print_subsys+0xd0>
mov    -0x8(%rbp),%rsi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_subsys>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
call   1040 <parse_name@plt>
lea    0xe73(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1221 <print_subsys+0xb1>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     120a <print_subsys+0x9a>
mov    %rsp,%rbx
lea    0xe42(%rip),%r15
mov    0x2e19(%rip),%r12
jmp    11e5 <print_subsys+0x75>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     120a <print_subsys+0x9a>
mov    %rbx,%rdi
call   1090 <empty_line@plt>
test   %rax,%rax
jne    11d0 <print_subsys+0x60>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1060 <fputs@plt>
jmp    11d0 <print_subsys+0x60>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xddd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c" \00"
@stdout = global i32 0
@.str.2 = [20 x i8] c"Error opening '%s'\0A\00"
define void @print_subsys(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = alloca i32*
store i8* %0, i8** %2
store i32* null, i32** %4
%5 = load i8*, i8** %2
%6 = call i32 @parse_name(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %4
%9 = load i32*, i32** %4
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %30
11: ; preds = %1
br label %12
12: ; preds = %26, %11
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%14 = load i32*, i32** %4
%15 = call i32* @fgets(i8* %13, i32 256, i32* %14)
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%19 = call i64 @empty_line(i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%24 = load i32, i32* @stdout
%25 = call i32 @fputs(i8* %23, i32 %24)
br label %26
26: ; preds = %21, %17
br label %12
27: ; preds = %12
%28 = load i32*, i32** %4
%29 = call i32 @fclose(i32* %28)
br label %33
30: ; preds = %1
%31 = load i8*, i8** %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30, %27
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c" \00"
@stdout = global i32 0
@.str.2 = [20 x i8] c"Error opening '%s'\0A\00"
define void @print_subsys(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @parse_name(i8* %0)
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %22, label %7
7: ; preds = %1
%8 = call i32* @fgets(i8* %3, i32 256, i32* %5)
%9 = icmp eq i32* %8, null
br i1 %9, label %20, label %10
10: ; preds = %7, %17
%11 = call i64 @empty_line(i8* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* %3, i32 %15)
br label %17
17: ; preds = %13, %10
%18 = call i32* @fgets(i8* %3, i32 256, i32* %5)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %10
20: ; preds = %17, %7
%21 = call i32 @fclose(i32* %5)
br label %24
22: ; preds = %1
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %24
24: ; preds = %22, %20
ret void
}