#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*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
char *getenv(char *);
int /*<<< orphan*/ pm_message(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void showNetpbmHelp(const char progname[]) {
  const char *netpbmConfigFileName;
  FILE *netpbmConfigFile;
  char *docurl;
  if (getenv("NETPBM_CONF"))
    netpbmConfigFileName = getenv("NETPBM_CONF");
  else
    netpbmConfigFileName = "/etc/netpbm";
  netpbmConfigFile = fopen(netpbmConfigFileName, "r");
  if (netpbmConfigFile == NULL) {
    pm_message("Unable to open Netpbm configuration file '%s'.  "
               "Errno = %d (%s).  "
               "Use the NETPBM_CONF environment variable "
               "to control the identity of the Netpbm configuration file.",
               netpbmConfigFileName, errno, strerror(errno));
    docurl = NULL;
  } else {
    docurl = NULL;
    while (!feof(netpbmConfigFile) && !ferror(netpbmConfigFile)) {
      char line[80 + 1];
      fgets(line, sizeof(line), netpbmConfigFile);
      if (line[0] != '#') {
        sscanf(line, "docurl=%s", docurl);
      }
    }
    if (docurl == NULL)
      pm_message("No 'docurl=' line in Netpbm configuration file '%s'.",
                 netpbmConfigFileName);
    fclose(netpbmConfigFile);
  }
  if (docurl == NULL)
    pm_message("We have no reliable indication of where the Netpbm "
               "documentation is, but try "
               "http://netpbm.sourceforge.net or email "
               "Bryan Henderson (bryanh@giraffe-data.com) for help.");
  else
    pm_message("This program is part of the Netpbm package.  Find "
               "documentation for it at %s/%s\n",
               docurl, progname);
}


x86 assembly (clang, -O0):
<showNetpbmHelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe5a(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11ca <showNetpbmHelp+0x3a>
lea    0xe44(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
jmp    11d5 <showNetpbmHelp+0x45>
lea    0xe3b(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1246 <showNetpbmHelp+0xb6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x90(%rbp),%rsi
mov    -0x84(%rbp),%edx
mov    %eax,%ecx
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1060 <pm_message@plt>
movq   $0x0,-0x20(%rbp)
jmp    12f2 <showNetpbmHelp+0x162>
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x91(%rbp)
jne    1281 <showNetpbmHelp+0xf1>
mov    -0x18(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x91(%rbp)
mov    -0x91(%rbp),%al
test   $0x1,%al
jne    1294 <showNetpbmHelp+0x104>
jmp    12cc <showNetpbmHelp+0x13c>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x51,%esi
call   1070 <fgets@plt>
movsbl -0x80(%rbp),%eax
cmp    $0x23,%eax
je     12c7 <showNetpbmHelp+0x137>
lea    -0x80(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdfd(%rip),%rsi
call   1090 <sscanf@plt>
jmp    124e <showNetpbmHelp+0xbe>
cmpq   $0x0,-0x20(%rbp)
jne    12e9 <showNetpbmHelp+0x159>
mov    -0x10(%rbp),%rsi
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1060 <pm_message@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x20(%rbp)
jne    1310 <showNetpbmHelp+0x180>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1060 <pm_message@plt>
jmp    1326 <showNetpbmHelp+0x196>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1060 <pm_message@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showNetpbmHelp>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe5e(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xe5b(%rip),%r14
cmovne %rax,%r14
lea    0xe5c(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     11f3 <showNetpbmHelp+0x63>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     1232 <showNetpbmHelp+0xa2>
lea    0xeea(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <pm_message@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    1218 <showNetpbmHelp+0x88>
mov    0x2de6(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10b0 <strerror@plt>
lea    0xe10(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <pm_message@plt>
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1060 <pm_message@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rsp,%r15
lea    0xe83(%rip),%r12
jmp    124c <showNetpbmHelp+0xbc>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    11d8 <showNetpbmHelp+0x48>
mov    %rbx,%rdi
call   1040 <ferror@plt>
test   %eax,%eax
jne    11d8 <showNetpbmHelp+0x48>
mov    %r15,%rdi
mov    $0x51,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
cmpb   $0x23,(%rsp)
je     1240 <showNetpbmHelp+0xb0>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1090 <sscanf@plt>
jmp    1240 <showNetpbmHelp+0xb0>

LLVM IR (-O0):
@.str = [12 x i8] c"NETPBM_CONF\00"
@.str.1 = [12 x i8] c"/etc/netpbm\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [165 x i8] c"Unable to open Netpbm configuration file '%s'. Errno = %d (%s). Use the NETPBM_CONF environment variable to control the identity of the Netpbm configuration file.\00"
@errno = global i32 0
@.str.4 = [10 x i8] c"docurl=%s\00"
@.str.5 = [53 x i8] c"No 'docurl=' line in Netpbm configuration file '%s'.\00"
@.str.6 = [168 x i8] c"We have no reliable indication of where the Netpbm documentation is, but try http://netpbm.sourceforge.net or email Bryan Henderson (bryanh@giraffe-data.com) for help.\00"
@.str.7 = [81 x i8] c"This program is part of the Netpbm package. Find documentation for it at %s/%s\0A\00"
define void @showNetpbmHelp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca [81 x i8]
store i8* %0, i8** %2
%7 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %3
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %12
12: ; preds = %11, %9
%13 = load i8*, i8** %3
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %14, i32** %4
%15 = load i32*, i32** %4
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i32, i32* @errno
%20 = load i32, i32* @errno
%21 = call i32 @strerror(i32 %20)
%22 = call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str.3, i64 0, i64 0), i8* %18, i32 %19, i32 %21)
store i8* null, i8** %5
br label %57
23: ; preds = %12
store i8* null, i8** %5
br label %24
24: ; preds = %47, %23
%25 = load i32*, i32** %4
%26 = call i32 @feof(i32* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %24
%29 = load i32*, i32** %4
%30 = call i32 @ferror(i32* %29)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br label %33
33: ; preds = %28, %24
%34 = phi i1 [ false, %24 ], [ %32, %28 ]
br i1 %34, label %35, label %48
35: ; preds = %33
%36 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%37 = load i32*, i32** %4
%38 = call i32 @fgets(i8* %36, i32 81, i32* %37)
%39 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 35
br i1 %42, label %43, label %47
43: ; preds = %35
%44 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%45 = load i8*, i8** %5
%46 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %43, %35
br label %24
48: ; preds = %33
%49 = load i8*, i8** %5
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i8*, i8** %3
%53 = call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i8* %52)
br label %54
54: ; preds = %51, %48
%55 = load i32*, i32** %4
%56 = call i32 @fclose(i32* %55)
br label %57
57: ; preds = %54, %17
%58 = load i8*, i8** %5
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.6, i64 0, i64 0))
br label %66
62: ; preds = %57
%63 = load i8*, i8** %5
%64 = load i8*, i8** %2
%65 = call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.7, i64 0, i64 0), i8* %63, i8* %64)
br label %66
66: ; preds = %62, %60
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"NETPBM_CONF\00"
@.str.1 = [12 x i8] c"/etc/netpbm\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [165 x i8] c"Unable to open Netpbm configuration file '%s'. Errno = %d (%s). Use the NETPBM_CONF environment variable to control the identity of the Netpbm configuration file.\00"
@errno = global i32 0
@.str.4 = [10 x i8] c"docurl=%s\00"
@.str.5 = [53 x i8] c"No 'docurl=' line in Netpbm configuration file '%s'.\00"
@.str.6 = [168 x i8] c"We have no reliable indication of where the Netpbm documentation is, but try http://netpbm.sourceforge.net or email Bryan Henderson (bryanh@giraffe-data.com) for help.\00"
define void @showNetpbmHelp(i8* nocapture readnone %0) {
%2 = alloca [81 x i8]
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %3
%6 = tail call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = call i32 @feof(i32* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
br label %17
13: ; preds = %1
%14 = load i32, i32* @errno
%15 = tail call i32 @strerror(i32 %14)
%16 = tail call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str.3, i64 0, i64 0), i8* %5, i32 %14, i32 %15)
br label %32
17: ; preds = %11, %26
%18 = call i32 @ferror(i32* %6)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = call i32 @fgets(i8* %12, i32 81, i32* %6)
%22 = load i8, i8* %12
%23 = icmp eq i8 %22, 35
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* null)
br label %26
26: ; preds = %24, %20
%27 = call i32 @feof(i32* %6)
%28 = icmp eq i32 %27, 0
br i1 %28, label %17, label %29
29: ; preds = %26, %17, %8
%30 = call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%31 = call i32 @fclose(i32* %6)
br label %32
32: ; preds = %13, %29
%33 = call i32 (i8*, ...) @pm_message(i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.6, i64 0, i64 0))
ret void
}