#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 */
char EOF;
int /*<<< orphan*/ STDERR_FILENO;
int asprintf(char **, char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ pl_fatal(char *);
char *realpath(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void pl_usage() {
  FILE *fp;
  char c, *progc = NULL, *prog = realpath("/proc/self/exe", NULL);
  if (prog == NULL)
    pl_fatal("realpath");
  if (asprintf(&progc, "%s.c", prog) == -1)
    pl_fatal("asprintf");
  if ((fp = fopen(progc, "r")) == NULL)
    pl_fatal("fopen");
  if (getc(fp) == EOF)
    pl_fatal("getc");
  if (getc(fp) == EOF)
    pl_fatal("getc");
  if (getc(fp) == EOF)
    pl_fatal("getc");
  while (c != '\n') {
    if ((c = getc(fp)) == EOF)
      pl_fatal("getc");
    write(STDERR_FILENO, &c, 1);
  }
  exit(1);
}


x86 assembly (clang, -O0):
<pl_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x18(%rbp)
lea    0xe79(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <realpath@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11ab <pl_usage+0x3b>
lea    0xe69(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    -0x20(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1050 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    11d4 <pl_usage+0x64>
lea    0xe4e(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    -0x18(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    11fe <pl_usage+0x8e>
lea    0xe2f(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
movsbl %al,%eax
mov    0x2dd7(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1228 <pl_usage+0xb8>
lea    0xe0b(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
movsbl %al,%eax
mov    0x2dad(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1252 <pl_usage+0xe2>
lea    0xde1(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
movsbl %al,%eax
mov    0x2d83(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    127c <pl_usage+0x10c>
lea    0xdb7(%rip),%rdi
call   1070 <pl_fatal@plt>
jmp    1281 <pl_usage+0x111>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     12d7 <pl_usage+0x167>
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
mov    0x2d44(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    12bb <pl_usage+0x14b>
lea    0xd78(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
jmp    1281 <pl_usage+0x111>
mov    $0x1,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<pl_usage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
lea    0xe72(%rip),%rdi
xor    %esi,%esi
call   1040 <realpath@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11a9 <pl_usage+0x39>
lea    0xe6b(%rip),%rdi
call   1070 <pl_fatal@plt>
lea    0xe68(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %rbx,%rdx
call   1050 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    11ce <pl_usage+0x5e>
lea    0xe54(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    0x10(%rsp),%rdi
lea    0xe4c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    11f3 <pl_usage+0x83>
lea    0xe3a(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    %r15,%rdi
call   1090 <getc@plt>
mov    0x2de6(%rip),%r13
cmp    0x0(%r13),%al
jne    1214 <pl_usage+0xa4>
lea    0xe1f(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    %r15,%rdi
call   1090 <getc@plt>
cmp    0x0(%r13),%al
jne    122e <pl_usage+0xbe>
lea    0xe05(%rip),%rdi
call   1070 <pl_fatal@plt>
mov    %r15,%rdi
call   1090 <getc@plt>
cmp    0x0(%r13),%al
jne    1248 <pl_usage+0xd8>
lea    0xdeb(%rip),%rdi
call   1070 <pl_fatal@plt>
lea    0xddf(%rip),%r14
mov    0x2d82(%rip),%rbp
lea    0xf(%rsp),%r12
jmp    1275 <pl_usage+0x105>
nopl   (%rax)
mov    0x0(%rbp),%edi
mov    %r12,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0xa,%bl
je     1293 <pl_usage+0x123>
mov    %r15,%rdi
call   1090 <getc@plt>
mov    %eax,%ebx
mov    %al,0xf(%rsp)
cmp    0x0(%r13),%al
jne    1260 <pl_usage+0xf0>
mov    %r14,%rdi
call   1070 <pl_fatal@plt>
jmp    1260 <pl_usage+0xf0>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"/proc/self/exe\00"
@.str.1 = [9 x i8] c"realpath\00"
@.str.2 = [5 x i8] c"%s.c\00"
@.str.3 = [9 x i8] c"asprintf\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [6 x i8] c"fopen\00"
@EOF = global i8 0
@.str.6 = [5 x i8] c"getc\00"
@STDERR_FILENO = global i32 0
define void @pl_usage() {
%1 = alloca i32*
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i8*
store i8* null, i8** %3
%5 = call i8* @realpath(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* null)
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @pl_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = load i8*, i8** %4
%12 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @pl_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
%17 = load i8*, i8** %3
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %18, i32** %1
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @pl_fatal(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = load i32*, i32** %1
%24 = call signext i8 @getc(i32* %23)
%25 = sext i8 %24 to i32
%26 = load i8, i8* @EOF
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %25, %27
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %31
31: ; preds = %29, %22
%32 = load i32*, i32** %1
%33 = call signext i8 @getc(i32* %32)
%34 = sext i8 %33 to i32
%35 = load i8, i8* @EOF
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %34, %36
br i1 %37, label %38, label %40
38: ; preds = %31
%39 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38, %31
%41 = load i32*, i32** %1
%42 = call signext i8 @getc(i32* %41)
%43 = sext i8 %42 to i32
%44 = load i8, i8* @EOF
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %43, %45
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %40
br label %50
50: ; preds = %63, %49
%51 = load i8, i8* %2
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 10
br i1 %53, label %54, label %66
54: ; preds = %50
%55 = load i32*, i32** %1
%56 = call signext i8 @getc(i32* %55)
store i8 %56, i8* %2
%57 = sext i8 %56 to i32
%58 = load i8, i8* @EOF
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %57, %59
br i1 %60, label %61, label %63
61: ; preds = %54
%62 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %63
63: ; preds = %61, %54
%64 = load i32, i32* @STDERR_FILENO
%65 = call i32 @write(i32 %64, i8* %2, i32 1)
br label %50
66: ; preds = %50
%67 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"/proc/self/exe\00"
@.str.1 = [9 x i8] c"realpath\00"
@.str.2 = [5 x i8] c"%s.c\00"
@.str.3 = [9 x i8] c"asprintf\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [6 x i8] c"fopen\00"
@EOF = global i8 0
@.str.6 = [5 x i8] c"getc\00"
@STDERR_FILENO = global i32 0
define void @pl_usage() {
%1 = alloca i8
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = tail call i8* @realpath(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* null)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @pl_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @pl_fatal(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load i8*, i8** %2
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @pl_fatal(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = call signext i8 @getc(i32* %15)
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
%26 = call signext i8 @getc(i32* %15)
%27 = load i8, i8* @EOF
%28 = icmp eq i8 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = call signext i8 @getc(i32* %15)
%33 = load i8, i8* @EOF
%34 = icmp eq i8 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %37
37: ; preds = %31, %35
br label %38
38: ; preds = %37, %44
%39 = call signext i8 @getc(i32* %15)
store i8 %39, i8* %1
%40 = load i8, i8* @EOF
%41 = icmp eq i8 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @pl_fatal(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
%45 = load i32, i32* @STDERR_FILENO
%46 = call i32 @write(i32 %45, i8* %1, i32 1)
%47 = icmp eq i8 %39, 10
br i1 %47, label %48, label %38
48: ; preds = %44
%49 = call i32 @exit(i32 1)
unreachable
}