#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ supprDescriptor(char *, char *);
int /*<<< orphan*/ supprDescriptorHeader(int /*<<< orphan*/ *, char *, char *);
void checkDescriptorBase(FILE *base, FILE *log, char *baseType) {
  char currentId[100] = {0};
  char currentFileName[100] = {0};
  char buffer[100] = {0};
  int find = 0;
  FILE *file;
  while (!feof(base)) {
    fscanf(base, "%s\t%s\n", currentFileName, currentId);
    if (strcmp(currentFileName, "") == 0) {
      continue;
    }
    file = fopen(currentFileName, "r");
    if (file == NULL) {
      fprintf(log, "CHECK DATABASE : %s \t DELETED OF BASE ! \n",
              currentFileName);
      sprintf(buffer, "%s\t%s\n", currentFileName, currentId);
      supprDescriptorHeader(base, buffer, baseType);
      supprDescriptor(currentId, baseType);
      continue;
    }
    fclose(file);
  }
}


x86 assembly (clang, -O0):
<checkDescriptorBase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movl   $0x0,-0x164(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1215 <checkDescriptorBase+0x75>
jmp    12e6 <checkDescriptorBase+0x146>
mov    -0x8(%rbp),%rdi
lea    -0xf0(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    0xdd5(%rip),%rsi
call   1060 <fscanf@plt>
lea    -0xf0(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1252 <checkDescriptorBase+0xb2>
jmp    11f7 <checkDescriptorBase+0x57>
lea    -0xf0(%rbp),%rdi
lea    0xda7(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x170(%rbp)
cmpq   $0x0,-0x170(%rbp)
jne    12d5 <checkDescriptorBase+0x135>
mov    -0x10(%rbp),%rdi
lea    -0xf0(%rbp),%rdx
lea    0xd7d(%rip),%rsi
call   1080 <fprintf@plt>
lea    -0x160(%rbp),%rdi
lea    -0xf0(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    0xd56(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x160(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10a0 <supprDescriptorHeader@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <supprDescriptor@plt>
jmp    11f7 <checkDescriptorBase+0x57>
mov    -0x170(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11f7 <checkDescriptorBase+0x57>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkDescriptorBase>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
mov    %rdx,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movl   $0x0,0x150(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xe0(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
call   1080 <feof@plt>
test   %eax,%eax
je     1267 <checkDescriptorBase+0xd7>
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd92(%rip),%r12
lea    0x80(%rsp),%r13
lea    0xf0(%rsp),%r14
lea    0xdad(%rip),%r15
jmp    12ed <checkDescriptorBase+0x15d>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
lea    0xd6d(%rip),%rsi
mov    %r13,%rdx
call   1070 <fprintf@plt>
mov    %r15,%rbp
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%r15
mov    (%rsp),%rbp
mov    %rbp,%rdx
call   1090 <supprDescriptorHeader@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <supprDescriptor@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1255 <checkDescriptorBase+0xc5>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
call   1050 <fscanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12dd <checkDescriptorBase+0x14d>
mov    %r13,%rdi
lea    0xcef(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1290 <checkDescriptorBase+0x100>
mov    %rax,%rdi
call   1030 <fclose@plt>
jmp    12dd <checkDescriptorBase+0x14d>

LLVM IR (-O0):
@.str = [7 x i8] c"%s\09%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [42 x i8] c"CHECK DATABASE : %s \09 DELETED OF BASE ! \0A\00"
define void @checkDescriptorBase(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca i32
%11 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%12 = bitcast [100 x i8]* %7 to i8*
%13 = bitcast [100 x i8]* %8 to i8*
%14 = bitcast [100 x i8]* %9 to i8*
store i32 0, i32* %10
br label %15
15: ; preds = %49, %34, %28, %3
%16 = load i32*, i32** %4
%17 = call i32 @feof(i32* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br i1 %19, label %20, label %52
20: ; preds = %15
%21 = load i32*, i32** %4
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%24 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %23)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %20
br label %15
29: ; preds = %20
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %31, i32** %11
%32 = load i32*, i32** %11
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %49
34: ; preds = %29
%35 = load i32*, i32** %5
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%37 = call i32 @fprintf(i32* %35, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%41 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %39, i8* %40)
%42 = load i32*, i32** %4
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%44 = load i8*, i8** %6
%45 = call i32 @supprDescriptorHeader(i32* %42, i8* %43, i8* %44)
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%47 = load i8*, i8** %6
%48 = call i32 @supprDescriptor(i8* %46, i8* %47)
br label %15
49: ; preds = %29
%50 = load i32*, i32** %11
%51 = call i32 @fclose(i32* %50)
br label %15
52: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s\09%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [42 x i8] c"CHECK DATABASE : %s \09 DELETED OF BASE ! \0A\00"
define void @checkDescriptorBase(i32* %0, i32* nocapture %1, i8* %2) {
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = call i32 @feof(i32* %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %3, %24
%13 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %7)
%14 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %24, label %16
16: ; preds = %12
%17 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%21 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %7)
%22 = call i32 @supprDescriptorHeader(i32* %0, i8* %9, i8* %2)
%23 = call i32 @supprDescriptor(i8* %7, i8* %2)
br label %24
24: ; preds = %19, %27, %12
%25 = call i32 @feof(i32* %0)
%26 = icmp eq i32 %25, 0
br i1 %26, label %12, label %29
27: ; preds = %16
%28 = call i32 @fclose(i32* %17)
br label %24
29: ; preds = %24, %3
ret void
}