#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 */

/* Variables and functions */
int MAXPATHLEN;
int /*<<< orphan*/ doinfo1(char *);
char *filter(char *);
scalar_t__ ispattern(char *);
int /*<<< orphan*/ makename(char *, char *);
int /*<<< orphan*/ matchinit(char *);
char *matchnext();
int /*<<< orphan*/ message(char *, char *);
void doinfo(int ac, char **av) {
  char name[MAXPATHLEN], *file;
  while (*++av) {
    if (!makename(*av, name)) {
      message("Bad file name: %s", *av);
      continue;
    }
    if (ispattern(name)) {
      if (!matchinit(name)) {
        message("No such file or directory: %s", filter(name));
        continue;
      }
      while ((file = matchnext()))
        doinfo1(file);
    } else
      doinfo1(name);
  }
}


x86 assembly (clang, -O0):
<doinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,0x8(%rax)
je     1273 <doinfo+0x103>
mov    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <makename@plt>
cmp    $0x0,%eax
jne    11f6 <doinfo+0x86>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe14(%rip),%rdi
call   1040 <message@plt>
jmp    11ab <doinfo+0x3b>
mov    -0x30(%rbp),%rdi
call   1090 <ispattern@plt>
cmp    $0x0,%rax
je     1265 <doinfo+0xf5>
mov    -0x30(%rbp),%rdi
call   1030 <matchinit@plt>
cmp    $0x0,%eax
jne    1238 <doinfo+0xc8>
mov    -0x30(%rbp),%rdi
call   1060 <filter@plt>
mov    %rax,%rsi
lea    0xde4(%rip),%rdi
call   1040 <message@plt>
jmp    11ab <doinfo+0x3b>
jmp    123d <doinfo+0xcd>
mov    $0x0,%al
call   1080 <matchnext@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1260 <doinfo+0xf0>
mov    -0x28(%rbp),%rdi
call   1070 <doinfo1@plt>
jmp    123d <doinfo+0xcd>
jmp    126e <doinfo+0xfe>
mov    -0x30(%rbp),%rdi
call   1070 <doinfo1@plt>
jmp    11ab <doinfo+0x3b>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doinfo>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     123d <doinfo+0xcd>
mov    %rsi,%rbx
add    $0x8,%rbx
lea    0xe50(%rip),%r15
lea    0xe5b(%rip),%r12
jmp    11d2 <doinfo+0x62>
nopl   0x0(%rax)
call   1070 <doinfo1@plt>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     123d <doinfo+0xcd>
mov    %r14,%rsi
call   1050 <makename@plt>
test   %eax,%eax
je     1230 <doinfo+0xc0>
mov    %r14,%rdi
call   1090 <ispattern@plt>
mov    %r14,%rdi
test   %rax,%rax
je     11c0 <doinfo+0x50>
call   1030 <matchinit@plt>
test   %eax,%eax
jne    1218 <doinfo+0xa8>
mov    %r14,%rdi
call   1060 <filter@plt>
mov    %r12,%rdi
mov    %rax,%rsi
jmp    1236 <doinfo+0xc6>
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1070 <doinfo1@plt>
xor    %eax,%eax
call   1080 <matchnext@plt>
test   %rax,%rax
jne    1210 <doinfo+0xa0>
jmp    11c5 <doinfo+0x55>
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx),%rsi
mov    %r15,%rdi
call   1040 <message@plt>
jmp    11c5 <doinfo+0x55>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MAXPATHLEN = global i32 0
@.str = [18 x i8] c"Bad file name: %s\00"
@.str.1 = [30 x i8] c"No such file or directory: %s\00"
define void @doinfo(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = load i32, i32* @MAXPATHLEN
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %5
%11 = alloca i8, i64 %9
store i64 %9, i64* %6
br label %12
12: ; preds = %45, %32, %22, %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %4
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %46
17: ; preds = %12
%18 = load i8**, i8*** %4
%19 = load i8*, i8** %18
%20 = call i32 @makename(i8* %19, i8* %11)
%21 = icmp ne i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %17
%23 = load i8**, i8*** %4
%24 = load i8*, i8** %23
%25 = call i32 @message(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %24)
br label %12
26: ; preds = %17
%27 = call i64 @ispattern(i8* %11)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = call i32 @matchinit(i8* %11)
%31 = icmp ne i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = call i8* @filter(i8* %11)
%34 = call i32 @message(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %12
35: ; preds = %29
br label %36
36: ; preds = %39, %35
%37 = call i8* (...) @matchnext()
store i8* %37, i8** %7
%38 = icmp ne i8* %37, null
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i8*, i8** %7
%41 = call i32 @doinfo1(i8* %40)
br label %36
42: ; preds = %36
br label %45
43: ; preds = %26
%44 = call i32 @doinfo1(i8* %11)
br label %45
45: ; preds = %43, %42
br label %12
46: ; preds = %12
%47 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@MAXPATHLEN = global i32 0
@.str = [18 x i8] c"Bad file name: %s\00"
@.str.1 = [30 x i8] c"No such file or directory: %s\00"
define void @doinfo(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @MAXPATHLEN
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %40, label %9
9: ; preds = %2, %17
%10 = phi i8* [ %19, %17 ], [ %7, %2 ]
%11 = phi i8** [ %18, %17 ], [ %6, %2 ]
%12 = call i32 @makename(i8* %10, i8* %5)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i8*, i8** %11
%16 = call i32 @message(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %33, %38, %27, %14, %30
%18 = getelementptr inbounds i8*, i8** %11, i64 1
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %40, label %9
21: ; preds = %9
%22 = call i64 @ispattern(i8* %5)
%23 = icmp eq i64 %22, 0
br i1 %23, label %38, label %24
24: ; preds = %21
%25 = call i32 @matchinit(i8* %5)
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = call i8* (...) @matchnext()
%29 = icmp eq i8* %28, null
br i1 %29, label %17, label %33
30: ; preds = %24
%31 = call i8* @filter(i8* %5)
%32 = call i32 @message(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %17
33: ; preds = %27, %33
%34 = phi i8* [ %36, %33 ], [ %28, %27 ]
%35 = call i32 @doinfo1(i8* %34)
%36 = call i8* (...) @matchnext()
%37 = icmp eq i8* %36, null
br i1 %37, label %17, label %33
38: ; preds = %21
%39 = call i32 @doinfo1(i8* %5)
br label %17
40: ; preds = %17, %2
ret void
}