#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 main(void) {
  char dump[30], database[30], username[30], password[30], c;
  int i = 0;
  password[0] = '\0';
  printf("login amministratore del database.\n");
  printf("username:");
  scanf("%s", username);
  printf("\npassword:");
  scanf("%s", password);
  printf("\ndump sql da inserire: ");
  scanf("%s", dump);
  while ((c = dump[i]) != '.') {
    database[i] = c;
    i++;
  }
  database[i] = '\0';
  printf("\n%s, %s, %s, %s", dump, database, username, password);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x98(%rbp)
movb   $0x0,-0x90(%rbp)
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xef4(%rip),%rdi
call   1040 <scanf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xed3(%rip),%rdi
call   1040 <scanf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x98(%rbp),%rax
mov    -0x30(%rbp,%rax,1),%al
mov    %al,-0x91(%rbp)
movsbl %al,%eax
cmp    $0x2e,%eax
je     11f0 <main+0xd0>
mov    -0x91(%rbp),%cl
movslq -0x98(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    11ae <main+0x8e>
movslq -0x98(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    -0x90(%rbp),%r8
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movb   $0x0,0x20(%rsp)
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed7(%rip),%rbx
lea    0x60(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%al
cmp    $0x2e,%al
je     11c4 <main+0x94>
xor    %ecx,%ecx
nopl   (%rax)
mov    %al,0x40(%rsp,%rcx,1)
movzbl 0x1(%rsp,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x2e,%al
jne    11b0 <main+0x80>
mov    %ecx,%r14d
movb   $0x0,0x40(%rsp,%r14,1)
lea    0xe5c(%rip),%rdi
mov    %rsp,%rsi
lea    0x40(%rsp),%rdx
lea    0x60(%rsp),%rcx
lea    0x20(%rsp),%r8
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"login amministratore del database.\0A\00"
@.str.1 = [10 x i8] c"username:\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [11 x i8] c"\0Apassword:\00"
@.str.4 = [24 x i8] c"\0Adump sql da inserire: \00"
@.str.5 = [16 x i8] c"\0A%s, %s, %s, %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
store i8 0, i8* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %26, %0
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
store i8 %23, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 46
br i1 %25, label %26, label %33
26: ; preds = %19
%27 = load i8, i8* %6
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %29
store i8 %27, i8* %30
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %19
33: ; preds = %19
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %35
store i8 0, i8* %36
%37 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%38 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%39 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%40 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %37, i8* %38, i8* %39, i8* %40)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"username:\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [11 x i8] c"\0Apassword:\00"
@.str.4 = [24 x i8] c"\0Adump sql da inserire: \00"
@.str.5 = [16 x i8] c"\0A%s, %s, %s, %s\00"
@str = [35 x i8] c"login amministratore del database.\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
store i8 0, i8* %8
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%16 = load i8, i8* %5
%17 = icmp eq i8 %16, 46
br i1 %17, label %28, label %18
18: ; preds = %0, %18
%19 = phi i64 [ %22, %18 ], [ 0, %0 ]
%20 = phi i8 [ %24, %18 ], [ %16, %0 ]
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %19
store i8 %20, i8* %21
%22 = add nuw nsw i64 %19, 1
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 46
br i1 %25, label %26, label %18
26: ; preds = %18
%27 = and i64 %22, 4294967295
br label %28
28: ; preds = %26, %0
%29 = phi i64 [ 0, %0 ], [ %27, %26 ]
%30 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %29
store i8 0, i8* %30
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %5, i8* %6, i8* %7, i8* %8)
ret i32 0
}