#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int gl_pathc;
  char **gl_pathv;
};
typedef TYPE_1__ glob_t;

/* Variables and functions */
int GLOB_APPEND;
int GLOB_DOOFFS;
int GLOB_ERR;
int GLOB_MARK;
int GLOB_NOCHECK;
int GLOB_NOESCAPE;
int GLOB_NOSORT;
int WRDE_APPEND;
int WRDE_DOOFFS;
int WRDE_NOCMD;
int WRDE_REUSE;
int glob(char *, int /*<<< orphan*/, int /*<<< orphan*/ *, TYPE_1__ *);
int /*<<< orphan*/ printf(char *, char *, ...);
int main() {
  printf("%s = 0x%d\n", "GLOB_ERR", GLOB_ERR);
  printf("%s = 0x%d\n", "GLOB_MARK", GLOB_MARK);
  printf("%s = 0x%d\n", "GLOB_NOSORT", GLOB_NOSORT);
  printf("%s = 0x%d\n", "GLOB_DOOFFS", GLOB_DOOFFS);
  printf("%s = 0x%d\n", "GLOB_NOCHECK", GLOB_NOCHECK);
  printf("%s = 0x%d\n", "GLOB_APPEND", GLOB_APPEND);
  printf("%s = 0x%d\n", "GLOB_NOESCAPE", GLOB_NOESCAPE);
  printf("%s = 0x%d\n", "WRDE_APPEND", WRDE_APPEND);
  printf("%s = 0x%d\n", "WRDE_DOOFFS", WRDE_DOOFFS);
  printf("%s = 0x%d\n", "WRDE_NOCMD", WRDE_NOCMD);
  printf("%s = 0x%d\n", "WRDE_REUSE", WRDE_REUSE);
  int i;
  glob_t out;
  int glb = glob("*.[c|h]", 0, NULL, &out);
  for (i = 0; i < out.gl_pathc; i++) {
    printf("%s\n", out.gl_pathv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
lea    0xec1(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
lea    0xea3(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edx
lea    0xe85(%rip),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edx
lea    0xe67(%rip),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%edx
lea    0xe49(%rip),%rdi
lea    0xe78(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edx
lea    0xe2b(%rip),%rdi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edx
lea    0xe0d(%rip),%rdi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edx
lea    0xdef(%rip),%rdi
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edx
lea    0xdd1(%rip),%rdi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%edx
lea    0xdb3(%rip),%rdi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edx
lea    0xd95(%rip),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0b(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
lea    -0x18(%rbp),%rcx
call   1040 <glob@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12cd <main+0x1ad>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1299 <main+0x179>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2eba(%rip),%rax
mov    (%rax),%edx
lea    0xec9(%rip),%rbx
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edx
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edx
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edx
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edx
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edx
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%edx
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edx
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%edx
lea    0xe4d(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%edx
lea    0xe3e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
lea    0x8(%rsp),%rcx
xor    %esi,%esi
xor    %edx,%edx
call   1040 <glob@plt>
cmpl   $0x0,0x8(%rsp)
jle    12a1 <main+0x181>
lea    0xe24(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
mov    (%rax,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1280 <main+0x160>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i8** }
@.str = [11 x i8] c"%s = 0x%d\0A\00"
@.str.1 = [9 x i8] c"GLOB_ERR\00"
@GLOB_ERR = global i32 0
@.str.2 = [10 x i8] c"GLOB_MARK\00"
@GLOB_MARK = global i32 0
@.str.3 = [12 x i8] c"GLOB_NOSORT\00"
@GLOB_NOSORT = global i32 0
@.str.4 = [12 x i8] c"GLOB_DOOFFS\00"
@GLOB_DOOFFS = global i32 0
@.str.5 = [13 x i8] c"GLOB_NOCHECK\00"
@GLOB_NOCHECK = global i32 0
@.str.6 = [12 x i8] c"GLOB_APPEND\00"
@GLOB_APPEND = global i32 0
@.str.7 = [14 x i8] c"GLOB_NOESCAPE\00"
@GLOB_NOESCAPE = global i32 0
@.str.8 = [12 x i8] c"WRDE_APPEND\00"
@WRDE_APPEND = global i32 0
@.str.9 = [12 x i8] c"WRDE_DOOFFS\00"
@WRDE_DOOFFS = global i32 0
@.str.10 = [11 x i8] c"WRDE_NOCMD\00"
@WRDE_NOCMD = global i32 0
@.str.11 = [11 x i8] c"WRDE_REUSE\00"
@WRDE_REUSE = global i32 0
@.str.12 = [8 x i8] c"*.[c|h]\00"
@.str.13 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.TYPE_3__
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @GLOB_ERR
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @GLOB_MARK
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @GLOB_NOSORT
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @GLOB_DOOFFS
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @GLOB_NOCHECK
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @GLOB_APPEND
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @GLOB_NOESCAPE
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @WRDE_APPEND
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %19)
%21 = load i32, i32* @WRDE_DOOFFS
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @WRDE_NOCMD
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %23)
%25 = load i32, i32* @WRDE_REUSE
%26 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 %25)
%27 = call i32 @glob(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i32 0, i32* null, %struct.TYPE_3__* %3)
store i32 %27, i32* %4
store i32 0, i32* %2
br label %28
28: ; preds = %41, %0
%29 = load i32, i32* %2
%30 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%31 = load i32, i32* %30
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %44
33: ; preds = %28
%34 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
%35 = load i8**, i8*** %34
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %33
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %28
44: ; preds = %28
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i8** }
@.str = [11 x i8] c"%s = 0x%d\0A\00"
@.str.1 = [9 x i8] c"GLOB_ERR\00"
@GLOB_ERR = global i32 0
@.str.2 = [10 x i8] c"GLOB_MARK\00"
@GLOB_MARK = global i32 0
@.str.3 = [12 x i8] c"GLOB_NOSORT\00"
@GLOB_NOSORT = global i32 0
@.str.4 = [12 x i8] c"GLOB_DOOFFS\00"
@GLOB_DOOFFS = global i32 0
@.str.5 = [13 x i8] c"GLOB_NOCHECK\00"
@GLOB_NOCHECK = global i32 0
@.str.6 = [12 x i8] c"GLOB_APPEND\00"
@GLOB_APPEND = global i32 0
@.str.7 = [14 x i8] c"GLOB_NOESCAPE\00"
@GLOB_NOESCAPE = global i32 0
@.str.8 = [12 x i8] c"WRDE_APPEND\00"
@WRDE_APPEND = global i32 0
@.str.9 = [12 x i8] c"WRDE_DOOFFS\00"
@WRDE_DOOFFS = global i32 0
@.str.10 = [11 x i8] c"WRDE_NOCMD\00"
@WRDE_NOCMD = global i32 0
@.str.11 = [11 x i8] c"WRDE_REUSE\00"
@WRDE_REUSE = global i32 0
@.str.12 = [8 x i8] c"*.[c|h]\00"
@.str.13 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca %struct.TYPE_3__
%2 = load i32, i32* @GLOB_ERR
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @GLOB_MARK
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @GLOB_NOSORT
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @GLOB_DOOFFS
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @GLOB_NOCHECK
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @GLOB_APPEND
%13 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @GLOB_NOESCAPE
%15 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @WRDE_APPEND
%17 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @WRDE_DOOFFS
%19 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @WRDE_NOCMD
%21 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %20)
%22 = load i32, i32* @WRDE_REUSE
%23 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i32 %22)
%24 = bitcast %struct.TYPE_3__* %1 to i8*
%25 = call i32 @glob(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i32 0, i32* null, %struct.TYPE_3__* %1)
%26 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%27 = load i32, i32* %26
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %41
29: ; preds = %0
%30 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ 0, %29 ], [ %37, %31 ]
%33 = load i8**, i8*** %30
%34 = getelementptr inbounds i8*, i8** %33, i64 %32
%35 = load i8*, i8** %34
%36 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %35)
%37 = add nuw nsw i64 %32, 1
%38 = load i32, i32* %26
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %31, label %41
41: ; preds = %31, %0
ret i32 0
}