#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
void showHelp(void) {
  FILE *in;
  in = fopen("helpString", "r");
  if (in == NULL) {
    fprintf(
        stderr,
        "Sorry something happened to printHelp file:(\nI cannot print help");
    return;
  }
  size_t len;
  char *input = NULL;
  char read;
  while ((read = getline(&input, &len, in)) != -1) {
    printf("%s", input);
  }
  fclose(in);
}


x86 assembly (clang, -O0):
<showHelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1194 <showHelp+0x44>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11da <showHelp+0x8a>
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <getline@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     11d1 <showHelp+0x81>
mov    -0x18(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
jmp    119c <showHelp+0x4c>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showHelp>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9e(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11e3 <showHelp+0x93>
mov    %rax,%rbx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rax,%rdx
call   1070 <getline@plt>
cmp    $0xff,%al
je     11cf <showHelp+0x7f>
lea    0xeb2(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1070 <getline@plt>
cmp    $0xff,%al
jne    11b0 <showHelp+0x60>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"helpString\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [65 x i8] c"Sorry something happened to printHelp file:(\0AI cannot print help\00"
@.str.3 = [3 x i8] c"%s\00"
define void @showHelp() {
%1 = alloca i32*
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8
%5 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %1
%6 = load i32*, i32** %1
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
br label %23
11: ; preds = %0
store i8* null, i8** %3
br label %12
12: ; preds = %17, %11
%13 = load i32*, i32** %1
%14 = call signext i8 @getline(i8** %3, i64* %2, i32* %13)
store i8 %14, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %18)
br label %12
20: ; preds = %12
%21 = load i32*, i32** %1
%22 = call i32 @fclose(i32* %21)
br label %23
23: ; preds = %20, %8
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"helpString\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [65 x i8] c"Sorry something happened to printHelp file:(\0AI cannot print help\00"
@.str.3 = [3 x i8] c"%s\00"
define void @showHelp() {
%1 = alloca i64
%2 = alloca i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
br label %20
8: ; preds = %0
%9 = bitcast i64* %1 to i8*
%10 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%11 = call signext i8 @getline(i8** %2, i64* %1, i32* %3)
%12 = icmp eq i8 %11, -1
br i1 %12, label %18, label %13
13: ; preds = %8, %13
%14 = load i8*, i8** %2
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = call signext i8 @getline(i8** %2, i64* %1, i32* %3)
%17 = icmp eq i8 %16, -1
br i1 %17, label %18, label %13
18: ; preds = %13, %8
%19 = call i32 @fclose(i32* %3)
br label %20
20: ; preds = %18, %5
ret void
}