#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scan_dir(char *, char *, int);
int main(int argc, char *argv[]) {
  int FLAG = 0;
  if (argc < 2) {
    printf("\n\n        nacs V 0.1 Beta   \\/ ><    Virusscanner fuer den LDV "
           "I\n\n"
           "Aufruf: <nacs [directory] [logfile]> scannt 'directory' mit allen "
           "Unterverzeichnissen\n\n");
    exit(0);
  }
  if (argc == 4)
    FLAG = 1;
  scan_dir(argv[1], argv[2], FLAG);
  printf("\n\nnacs: fertig\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116a <main+0x3a>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jne    117b <main+0x4b>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x14(%rbp),%edx
call   1030 <scan_dir@plt>
lea    0xf00(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jle    115b <main+0x2b>
xor    %edx,%edx
cmp    $0x4,%edi
sete   %dl
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <scan_dir@plt>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [154 x i8] c"\0A\0A nacs V 0.1 Beta \\/ >< Virusscanner fuer den LDV I\0A\0AAufruf: <nacs [directory] [logfile]> scannt 'directory' mit allen Unterverzeichnissen\0A\0A\00"
@.str.1 = [17 x i8] c"\0A\0Anacs: fertig\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 1, i32* %6
br label %16
16: ; preds = %15, %12
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = load i32, i32* %6
%24 = call i32 @scan_dir(i8* %19, i8* %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"\0A\0Anacs: fertig\0A\00"
@str.2 = [153 x i8] c"\0A\0A nacs V 0.1 Beta \\/ >< Virusscanner fuer den LDV I\0A\0AAufruf: <nacs [directory] [logfile]> scannt 'directory' mit allen Unterverzeichnissen\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([153 x i8], [153 x i8]* @str.2, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
%8 = icmp eq i32 %0, 4
%9 = zext i1 %8 to i32
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @scan_dir(i8* %11, i8* %13, i32 %9)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}