#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 */
int /*<<< orphan*/ con_errorf(char *, char const *);
int /*<<< orphan*/ con_run(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
void con_runfile(const char *path) {
  FILE *file;
  char line[256];
  file = fopen(path, "rt");
  if (file == NULL) {
    con_errorf("unable to open %s\n", path);
    return;
  }
  while (fgets(line, sizeof(line), file) != NULL) {
    con_run(line);
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<con_runfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1193 <con_runfile+0x43>
mov    -0x8(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1040 <con_errorf@plt>
jmp    11d1 <con_runfile+0x81>
jmp    1198 <con_runfile+0x48>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     11c8 <con_runfile+0x78>
lea    -0x110(%rbp),%rdi
call   1050 <con_run@plt>
jmp    1198 <con_runfile+0x48>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<con_runfile>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
lea    0xe9c(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11c0 <con_runfile+0x70>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11ad <con_runfile+0x5d>
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <con_run@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    1190 <con_runfile+0x40>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe3c(%rip),%rdi
mov    %rbx,%rsi
add    $0x108,%rsp
pop    %rbx
pop    %r14
jmp    1040 <con_errorf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [19 x i8] c"unable to open %s\0A\00"
define void @con_runfile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [256 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @con_errorf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %24
12: ; preds = %1
br label %13
13: ; preds = %18, %12
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%15 = load i32*, i32** %3
%16 = call i32* @fgets(i8* %14, i32 256, i32* %15)
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%20 = call i32 @con_run(i8* %19)
br label %13
21: ; preds = %13
%22 = load i32*, i32** %3
%23 = call i32 @fclose(i32* %22)
br label %24
24: ; preds = %21, %9
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [19 x i8] c"unable to open %s\0A\00"
define void @con_runfile(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* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = call i32* @fgets(i8* %3, i32 256, i32* %4)
%8 = icmp eq i32* %7, null
br i1 %8, label %15, label %11
9: ; preds = %1
%10 = tail call i32 @con_errorf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %17
11: ; preds = %6, %11
%12 = call i32 @con_run(i8* %3)
%13 = call i32* @fgets(i8* %3, i32 256, i32* %4)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %11
15: ; preds = %11, %6
%16 = call i32 @fclose(i32* %4)
br label %17
17: ; preds = %15, %9
ret void
}