#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*/ FlushCharArr(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
char getchar();
int /*<<< orphan*/ itoa(char, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int prop_menu();
int /*<<< orphan*/ scanf(char *, char *);
short db_create(char filename[]) {
  FILE *dbfile;
  char DataBuff[100] = {0};
  char Tabcount, countX, countY, temp;
  dbfile = fopen(filename, "at");
  if (dbfile == NULL) {
    printf("File ERROR!Program Terminated");
    exit(-1);
  }
  printf("How many rows are there?\n");
  scanf("%d", &Tabcount);
  itoa(Tabcount, &DataBuff[0], 10);
  countY = 0;
  do {
    temp = DataBuff[countY];
    printf("%c", temp);
    fputc(temp, dbfile);
    countY++;
  } while (temp != 0 && countY < 20);
  fputc(',', dbfile);
  for (countY = 1; countY <= Tabcount; countY++) {
    printf("Please Insert Name of row #%d\n", countY);
    getchar();
    while (countX < 255) {
      temp = getchar();
      if (temp != '\n') {
        fputc(temp, dbfile);
      } else
        break;
      countX++;
    }
    fputc(',', dbfile);
    printf("Please choose Property of the row #%d  \n", countY);
    fputc(prop_menu() + '0' - 1, dbfile);
    fputc(',', dbfile);
    FlushCharArr(DataBuff, 100);
  }
  fputc(0x0d, dbfile);
  fputc(0x0a, dbfile);
  fclose(dbfile);
  printf("Index generated successfully!\n");
  return 0;
}


x86 assembly (clang, -O0):
<db_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1206 <db_create+0x56>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe20(%rip),%rdi
lea    -0x81(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x81(%rbp),%al
lea    -0x80(%rbp),%rsi
mov    $0xa,%edx
movsbl %al,%edi
call   10d0 <itoa@plt>
movb   $0x0,-0x83(%rbp)
movsbq -0x83(%rbp),%rax
ff
mov    -0x80(%rbp,%rax,1),%al
mov    %al,-0x84(%rbp)
movsbl -0x84(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x84(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <fputc@plt>
mov    -0x83(%rbp),%al
add    $0x1,%al
mov    %al,-0x83(%rbp)
movsbl -0x84(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x85(%rbp)
je     12b5 <db_create+0x105>
movsbl -0x83(%rbp),%eax
cmp    $0x14,%eax
setl   %al
mov    %al,-0x85(%rbp)
mov    -0x85(%rbp),%al
test   $0x1,%al
jne    1245 <db_create+0x95>
mov    -0x10(%rbp),%rsi
mov    $0x2c,%edi
call   1060 <fputc@plt>
movb   $0x1,-0x83(%rbp)
movsbl -0x83(%rbp),%eax
movsbl -0x81(%rbp),%ecx
cmp    %ecx,%eax
jg     13d0 <db_create+0x220>
movsbl -0x83(%rbp),%esi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
movsbl -0x82(%rbp),%eax
cmp    $0xff,%eax
jge    1366 <db_create+0x1b6>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x84(%rbp)
movsbl -0x84(%rbp),%eax
cmp    $0xa,%eax
je     134e <db_create+0x19e>
movsbl -0x84(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <fputc@plt>
jmp    1353 <db_create+0x1a3>
jmp    1366 <db_create+0x1b6>
mov    -0x82(%rbp),%al
add    $0x1,%al
mov    %al,-0x82(%rbp)
jmp    130a <db_create+0x15a>
mov    -0x10(%rbp),%rsi
mov    $0x2c,%edi
call   1060 <fputc@plt>
movsbl -0x83(%rbp),%esi
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <prop_menu@plt>
mov    %eax,%edi
add    $0x30,%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1060 <fputc@plt>
mov    -0x10(%rbp),%rsi
mov    $0x2c,%edi
call   1060 <fputc@plt>
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   10a0 <FlushCharArr@plt>
mov    -0x83(%rbp),%al
add    $0x1,%al
mov    %al,-0x83(%rbp)
jmp    12d8 <db_create+0x128>
mov    -0x10(%rbp),%rsi
mov    $0xd,%edi
call   1060 <fputc@plt>
mov    -0x10(%rbp),%rsi
mov    $0xa,%edi
call   1060 <fputc@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
cwtl
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_create>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
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)
lea    0xe02(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1377 <db_create+0x1b7>
mov    %rax,%r14
lea    0xe56(%rip),%rdi
call   1040 <puts@plt>
lea    0xdff(%rip),%rdi
lea    0xf(%rsp),%rsi
call   10a0 <scanf@plt>
movsbl 0xf(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    $0xa,%edx
call   10e0 <itoa@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x10(%rsp,%rbx,1),%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
test   %ebp,%ebp
je     1277 <db_create+0xb7>
lea    0x1(%rbx),%rax
cmp    $0x13,%rbx
mov    %rax,%rbx
jb     1250 <db_create+0x90>
mov    $0x2c,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
cmpb   $0x0,0xf(%rsp)
jle    1338 <db_create+0x178>
mov    $0x1,%r15d
lea    0xd88(%rip),%rbx
lea    0xda0(%rip),%r12
lea    0x10(%rsp),%r13
jmp    1305 <db_create+0x145>
nopw   0x0(%rax,%rax,1)
mov    $0x2c,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1090 <prop_menu@plt>
lea    0x2f(%rax),%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    $0x2c,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    %r13,%rdi
mov    $0x64,%esi
call   10b0 <FlushCharArr@plt>
lea    0x1(%r15),%eax
movsbl %al,%r15d
cmp    0xf(%rsp),%r15b
jg     1338 <db_create+0x178>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0xa,%al
je     12b0 <db_create+0xf0>
movsbl %al,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
jmp    1320 <db_create+0x160>
mov    $0xd,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
lea    0xd24(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc85(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"at\00"
@.str.1 = [30 x i8] c"File ERROR!Program Terminated\00"
@.str.2 = [26 x i8] c"How many rows are there?\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [31 x i8] c"Please Insert Name of row #%d\0A\00"
@.str.6 = [41 x i8] c"Please choose Property of the row #%d \0A\00"
@.str.7 = [31 x i8] c"Index generated successfully!\0A\00"
define signext i16 @db_create(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [100 x i8]
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %2
%9 = bitcast [100 x i8]* %4 to i8*
%10 = load i8*, i8** %2
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %3
%12 = load i32*, i32** %3
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%20 = load i8, i8* %5
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%22 = call i32 @itoa(i8 signext %20, i8* %21, i32 10)
store i8 0, i8* %7
br label %23
23: ; preds = %45, %17
%24 = load i8, i8* %7
%25 = sext i8 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %25
%27 = load i8, i8* %26
store i8 %27, i8* %8
%28 = load i8, i8* %8
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = load i8, i8* %8
%32 = sext i8 %31 to i32
%33 = load i32*, i32** %3
%34 = call i32 @fputc(i32 %32, i32* %33)
%35 = load i8, i8* %7
%36 = add i8 %35, 1
store i8 %36, i8* %7
br label %37
37: ; preds = %23
%38 = load i8, i8* %8
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i8, i8* %7
%43 = sext i8 %42 to i32
%44 = icmp slt i32 %43, 20
br label %45
45: ; preds = %41, %37
%46 = phi i1 [ false, %37 ], [ %44, %41 ]
br i1 %46, label %23, label %47
47: ; preds = %45
%48 = load i32*, i32** %3
%49 = call i32 @fputc(i32 44, i32* %48)
store i8 1, i8* %7
br label %50
50: ; preds = %94, %47
%51 = load i8, i8* %7
%52 = sext i8 %51 to i32
%53 = load i8, i8* %5
%54 = sext i8 %53 to i32
%55 = icmp sle i32 %52, %54
br i1 %55, label %56, label %97
56: ; preds = %50
%57 = load i8, i8* %7
%58 = sext i8 %57 to i32
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %58)
%60 = call signext i8 (...) @getchar()
br label %61
61: ; preds = %76, %56
%62 = load i8, i8* %6
%63 = sext i8 %62 to i32
%64 = icmp slt i32 %63, 255
br i1 %64, label %65, label %79
65: ; preds = %61
%66 = call signext i8 (...) @getchar()
store i8 %66, i8* %8
%67 = load i8, i8* %8
%68 = sext i8 %67 to i32
%69 = icmp ne i32 %68, 10
br i1 %69, label %70, label %75
70: ; preds = %65
%71 = load i8, i8* %8
%72 = sext i8 %71 to i32
%73 = load i32*, i32** %3
%74 = call i32 @fputc(i32 %72, i32* %73)
br label %76
75: ; preds = %65
br label %79
76: ; preds = %70
%77 = load i8, i8* %6
%78 = add i8 %77, 1
store i8 %78, i8* %6
br label %61
79: ; preds = %75, %61
%80 = load i32*, i32** %3
%81 = call i32 @fputc(i32 44, i32* %80)
%82 = load i8, i8* %7
%83 = sext i8 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i32 %83)
%85 = call i32 (...) @prop_menu()
%86 = add nsw i32 %85, 48
%87 = sub nsw i32 %86, 1
%88 = load i32*, i32** %3
%89 = call i32 @fputc(i32 %87, i32* %88)
%90 = load i32*, i32** %3
%91 = call i32 @fputc(i32 44, i32* %90)
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%93 = call i32 @FlushCharArr(i8* %92, i32 100)
br label %94
94: ; preds = %79
%95 = load i8, i8* %7
%96 = add i8 %95, 1
store i8 %96, i8* %7
br label %50
97: ; preds = %50
%98 = load i32*, i32** %3
%99 = call i32 @fputc(i32 13, i32* %98)
%100 = load i32*, i32** %3
%101 = call i32 @fputc(i32 10, i32* %100)
%102 = load i32*, i32** %3
%103 = call i32 @fclose(i32* %102)
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
ret i16 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"at\00"
@.str.1 = [30 x i8] c"File ERROR!Program Terminated\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [31 x i8] c"Please Insert Name of row #%d\0A\00"
@.str.6 = [41 x i8] c"Please choose Property of the row #%d \0A\00"
@str = [25 x i8] c"How many rows are there?\00"
@str.8 = [30 x i8] c"Index generated successfully!\00"
define signext i16 @db_create(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%13 = load i8, i8* %3
%14 = call i32 @itoa(i8 signext %13, i8* %4, i32 10)
br label %15
15: ; preds = %15, %10
%16 = phi i64 [ %22, %15 ], [ 0, %10 ]
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = call i32 @putchar(i32 %19)
%21 = call i32 @fputc(i32 %19, i32* %5)
%22 = add nuw nsw i64 %16, 1
%23 = icmp ne i8 %18, 0
%24 = icmp ult i64 %16, 19
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %15, label %26
26: ; preds = %15
%27 = call i32 @fputc(i32 44, i32* %5)
%28 = load i8, i8* %3
%29 = icmp slt i8 %28, 1
br i1 %29, label %55, label %30
30: ; preds = %26, %43
%31 = phi i32 [ %52, %43 ], [ 1, %26 ]
%32 = trunc i32 %31 to i8
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%34 = call signext i8 (...) @getchar()
%35 = call signext i8 (...) @getchar()
%36 = icmp eq i8 %35, 10
br i1 %36, label %43, label %37
37: ; preds = %30, %37
%38 = phi i8 [ %41, %37 ], [ %35, %30 ]
%39 = sext i8 %38 to i32
%40 = call i32 @fputc(i32 %39, i32* %5)
%41 = call signext i8 (...) @getchar()
%42 = icmp eq i8 %41, 10
br i1 %42, label %43, label %37
43: ; preds = %37, %30
%44 = call i32 @fputc(i32 44, i32* %5)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%46 = call i32 (...) @prop_menu()
%47 = add nsw i32 %46, 47
%48 = call i32 @fputc(i32 %47, i32* %5)
%49 = call i32 @fputc(i32 44, i32* %5)
%50 = call i32 @FlushCharArr(i8* %4, i32 100)
%51 = add i8 %32, 1
%52 = sext i8 %51 to i32
%53 = load i8, i8* %3
%54 = icmp sgt i8 %51, %53
br i1 %54, label %55, label %30
55: ; preds = %43, %26
%56 = call i32 @fputc(i32 13, i32* %5)
%57 = call i32 @fputc(i32 10, i32* %5)
%58 = call i32 @fclose(i32* %5)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.8, i64 0, i64 0))
ret i16 0
}