#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
int create_database() {
  char db_name[50];
  char command[60] = "mkdir ";
  int i = 0;
  printf("\nEnter the name of the database: ");
  scanf("%s", db_name);
  while (db_name[i] != '\0') {
    command[i + 6] = db_name[i];
    i++;
  }
  command[i] = '\0';
  system(command);
  {
    char command[60] = "cd ";
    i = 0;
    while (db_name[i] != '\0') {
      command[i + 3] = db_name[i];
      i++;
    }
    command[i] = '\0';
  }
  return 0;
}


x86 assembly (clang, -O0):
<create_database>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x3c,%edx
call   1050 <memset@plt>
movb   $0x6d,-0x80(%rbp)
movb   $0x6b,-0x7f(%rbp)
movb   $0x64,-0x7e(%rbp)
movb   $0x69,-0x7d(%rbp)
movb   $0x72,-0x7c(%rbp)
movb   $0x20,-0x7b(%rbp)
movl   $0x0,-0x84(%rbp)
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1060 <scanf@plt>
movslq -0x84(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11dc <create_database+0x9c>
movslq -0x84(%rbp),%rax
mov    -0x40(%rbp,%rax,1),%cl
mov    -0x84(%rbp),%eax
add    $0x6,%eax
cltq
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1199 <create_database+0x59>
movslq -0x84(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
call   1030 <system@plt>
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3c,%edx
call   1050 <memset@plt>
movb   $0x63,-0xc0(%rbp)
movb   $0x64,-0xbf(%rbp)
movb   $0x20,-0xbe(%rbp)
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1269 <create_database+0x129>
movslq -0x84(%rbp),%rax
mov    -0x40(%rbp,%rax,1),%cl
mov    -0x84(%rbp),%eax
add    $0x3,%eax
cltq
mov    %cl,-0xc0(%rbp,%rax,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1223 <create_database+0xe3>
movslq -0x84(%rbp),%rax
movb   $0x0,-0xc0(%rbp,%rax,1)
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_database>:
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movups %xmm0,0x2c(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x69646b6d,(%rsp)
movw   $0x2072,0x4(%rsp)
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0x40(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x40(%rsp),%al
test   %al,%al
je     1195 <create_database+0x65>
xor    %ecx,%ecx
nop
mov    %al,0x6(%rsp,%rcx,1)
movzbl 0x41(%rsp,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1180 <create_database+0x50>
mov    %ecx,%eax
jmp    1197 <create_database+0x67>
xor    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0AEnter the name of the database: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @create_database() {
%1 = alloca [50 x i8]
%2 = alloca [60 x i8]
%3 = alloca i32
%4 = alloca [60 x i8]
%5 = bitcast [60 x i8]* %2 to i8*
%6 = bitcast i8* %5 to [60 x i8]*
%7 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i32 0, i32 0
store i8 109, i8* %7
%8 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i32 0, i32 1
store i8 107, i8* %8
%9 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i32 0, i32 2
store i8 100, i8* %9
%10 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i32 0, i32 3
store i8 105, i8* %10
%11 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i32 0, i32 4
store i8 114, i8* %11
%12 = getelementptr inbounds [60 x i8], [60 x i8]* %6, i32 0, i32 5
store i8 32, i8* %12
store i32 0, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %23, %0
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %16
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 %30
store i8 %27, i8* %31
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %16
34: ; preds = %16
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 %36
store i8 0, i8* %37
%38 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%39 = call i32 @system(i8* %38)
%40 = bitcast [60 x i8]* %4 to i8*
%41 = bitcast i8* %40 to [60 x i8]*
%42 = getelementptr inbounds [60 x i8], [60 x i8]* %41, i32 0, i32 0
store i8 99, i8* %42
%43 = getelementptr inbounds [60 x i8], [60 x i8]* %41, i32 0, i32 1
store i8 100, i8* %43
%44 = getelementptr inbounds [60 x i8], [60 x i8]* %41, i32 0, i32 2
store i8 32, i8* %44
store i32 0, i32* %3
br label %45
45: ; preds = %52, %34
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %63
52: ; preds = %45
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 3
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 %59
store i8 %56, i8* %60
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %45
63: ; preds = %45
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 %65
store i8 0, i8* %66
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0AEnter the name of the database: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @create_database() {
%1 = alloca [50 x i8]
%2 = alloca [60 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
store i8 109, i8* %4
%5 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 1
store i8 107, i8* %5
%6 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 2
store i8 100, i8* %6
%7 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 3
store i8 105, i8* %7
%8 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 4
store i8 114, i8* %8
%9 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 5
store i8 32, i8* %9
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%12 = load i8, i8* %3
%13 = icmp eq i8 %12, 0
br i1 %13, label %25, label %14
14: ; preds = %0, %14
%15 = phi i64 [ %19, %14 ], [ 0, %0 ]
%16 = phi i8 [ %21, %14 ], [ %12, %0 ]
%17 = add nuw nsw i64 %15, 6
%18 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 %17
store i8 %16, i8* %18
%19 = add nuw nsw i64 %15, 1
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %14
23: ; preds = %14
%24 = and i64 %19, 4294967295
br label %25
25: ; preds = %23, %0
%26 = phi i64 [ 0, %0 ], [ %24, %23 ]
%27 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 %26
store i8 0, i8* %27
%28 = call i32 @system(i8* %4)
ret i32 0
}