#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 */
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ extract_quotes(char *);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  DIR *dir;
  struct dirent *de;
  char buf[10024];
  if (argc < 2)
    return 0;
  dir = opendir(argv[1]);
  if (!dir)
    return 0;
  chdir(argv[1]);
  while (1) {
    de = readdir(dir);
    if (!de)
      break;
    if (de->d_name[0] == '.')
      continue;
    extract_quotes(de->d_name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2750,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116f <main+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1197 <main+0x57>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <chdir@plt>
mov    -0x18(%rbp),%rdi
call   1050 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c1 <main+0x81>
jmp    11ea <main+0xaa>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11d9 <main+0x99>
jmp    11a4 <main+0x64>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1060 <extract_quotes@plt>
jmp    11a4 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2750,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     118c <main+0x4c>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1030 <opendir@plt>
test   %rax,%rax
je     118c <main+0x4c>
mov    %rax,%rbx
mov    0x8(%r14),%rdi
call   1040 <chdir@plt>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <readdir@plt>
test   %rax,%rax
je     118c <main+0x4c>
mov    (%rax),%rdi
cmpb   $0x2e,(%rdi)
je     1170 <main+0x30>
call   1060 <extract_quotes@plt>
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca %struct.dirent*
%8 = alloca [10024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %46
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @opendir(i8* %15)
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %20, label %19
19: ; preds = %12
store i32 0, i32* %3
br label %46
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @chdir(i8* %23)
br label %25
25: ; preds = %20, %39, %40
%26 = load i32*, i32** %6
%27 = call %struct.dirent* @readdir(i32* %26)
store %struct.dirent* %27, %struct.dirent** %7
%28 = load %struct.dirent*, %struct.dirent** %7
%29 = icmp ne %struct.dirent* %28, null
br i1 %29, label %31, label %30
30: ; preds = %25
br label %45
31: ; preds = %25
%32 = load %struct.dirent*, %struct.dirent** %7
%33 = getelementptr inbounds %struct.dirent, %struct.dirent* %32, i32 0, i32 0
%34 = load i8*, i8** %33
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 46
br i1 %38, label %39, label %40
39: ; preds = %31
br label %25
40: ; preds = %31
%41 = load %struct.dirent*, %struct.dirent** %7
%42 = getelementptr inbounds %struct.dirent, %struct.dirent* %41, i32 0, i32 0
%43 = load i8*, i8** %42
%44 = call i32 @extract_quotes(i8* %43)
br label %25
45: ; preds = %30
store i32 0, i32* %3
br label %46
46: ; preds = %45, %19, %11
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %25, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @opendir(i8* %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %25, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i32 @chdir(i8* %10)
%12 = tail call %struct.dirent* @readdir(i32* %7)
%13 = icmp eq %struct.dirent* %12, null
br i1 %13, label %25, label %14
14: ; preds = %9, %22
%15 = phi %struct.dirent* [ %23, %22 ], [ %12, %9 ]
%16 = getelementptr inbounds %struct.dirent, %struct.dirent* %15, i64 0, i32 0
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 46
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = tail call i32 @extract_quotes(i8* %17)
br label %22
22: ; preds = %20, %14
%23 = tail call %struct.dirent* @readdir(i32* %7)
%24 = icmp eq %struct.dirent* %23, null
br i1 %24, label %25, label %14
25: ; preds = %22, %9, %4, %2
ret i32 0
}