#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 EXIT_SUCCESS;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[], char *envp[]) {
  char str[] = "hacking on planet hearth";
  printf("%.7s\n", str);
  printf("%10.7s %10.7s %10.7s\n", str, str, str);
  puts(str);
  char str1[64 + 1];
  char str2[64 + 1];
  char str3[64 + 1];
  char str4[11];
  printf("Inserisci la prima stringa: ");
  scanf("%s", str1);
  printf("str1 ----------> %s\n", str1);
  printf("Inserisci la seconda stringa: ");
  gets(str2);
  printf("str2 ----------> %s\n", str2);
  fgets(str3, 64 + 1, stdin);
  printf("str3 ----------> %s\n", str3);
  printf("Inserisci str4: ");
  scanf("%10s", str4);
  printf("str4 ----------> %s\n", str4);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0xe8c(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe89(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe86(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe84(%rip),%al
mov    %al,-0x28(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xe6a(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x90(%rbp),%rsi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    0x2da9(%rip),%rax
mov    (%rax),%edx
mov    $0x41,%esi
call   1050 <fgets@plt>
lea    -0x130(%rbp),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x13b(%rbp),%rsi
lea    0xe48(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x13b(%rbp),%rsi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d3b(%rip),%rax
mov    (%rax),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x120,%rsp
movups 0xeaa(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xea3(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    0xd0(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xe8c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edx
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x41,%esi
call   1050 <fgets@plt>
lea    0xe75(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    0x25(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
lea    0xe6d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%eax
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [25 x i8] c"hacking on planet hearth\00"
@.str = [6 x i8] c"%.7s\0A\00"
@.str.1 = [22 x i8] c"%10.7s %10.7s %10.7s\0A\00"
@.str.2 = [29 x i8] c"Inserisci la prima stringa: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [21 x i8] c"str1 ----------> %s\0A\00"
@.str.5 = [31 x i8] c"Inserisci la seconda stringa: \00"
@.str.6 = [21 x i8] c"str2 ----------> %s\0A\00"
@stdin = global i32 0
@.str.7 = [21 x i8] c"str3 ----------> %s\0A\00"
@.str.8 = [17 x i8] c"Inserisci str4: \00"
@.str.9 = [5 x i8] c"%10s\00"
@.str.10 = [21 x i8] c"str4 ----------> %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [25 x i8]
%9 = alloca [65 x i8]
%10 = alloca [65 x i8]
%11 = alloca [65 x i8]
%12 = alloca [11 x i8]
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%13 = bitcast [25 x i8]* %8 to i8*
%14 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%18 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17, i8* %18)
%20 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%21 = call i32 @puts(i8* %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%23 = getelementptr inbounds [65 x i8], [65 x i8]* %9, i64 0, i64 0
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [65 x i8], [65 x i8]* %9, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%28 = getelementptr inbounds [65 x i8], [65 x i8]* %10, i64 0, i64 0
%29 = call i32 @gets(i8* %28)
%30 = getelementptr inbounds [65 x i8], [65 x i8]* %10, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [65 x i8], [65 x i8]* %11, i64 0, i64 0
%33 = load i32, i32* @stdin
%34 = call i32 @fgets(i8* %32, i32 65, i32 %33)
%35 = getelementptr inbounds [65 x i8], [65 x i8]* %11, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %12, i64 0, i64 0
%39 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds [11 x i8], [11 x i8]* %12, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %40)
%42 = load i32, i32* @EXIT_SUCCESS
ret i32 %42
}

LLVM IR (-O2):
@__const.main.str = [25 x i8] c"hacking on planet hearth\00"
@.str = [6 x i8] c"%.7s\0A\00"
@.str.1 = [22 x i8] c"%10.7s %10.7s %10.7s\0A\00"
@.str.2 = [29 x i8] c"Inserisci la prima stringa: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [21 x i8] c"str1 ----------> %s\0A\00"
@.str.5 = [31 x i8] c"Inserisci la seconda stringa: \00"
@.str.6 = [21 x i8] c"str2 ----------> %s\0A\00"
@stdin = global i32 0
@.str.7 = [21 x i8] c"str3 ----------> %s\0A\00"
@.str.8 = [17 x i8] c"Inserisci str4: \00"
@.str.9 = [5 x i8] c"%10s\00"
@.str.10 = [21 x i8] c"str4 ----------> %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [25 x i8]
%5 = alloca [65 x i8]
%6 = alloca [65 x i8]
%7 = alloca [65 x i8]
%8 = alloca [11 x i8]
%9 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %9, i8* %9)
%12 = call i32 @puts(i8* %9)
%13 = getelementptr inbounds [65 x i8], [65 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [65 x i8], [65 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [65 x i8], [65 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %8, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @gets(i8* %14)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %14)
%23 = load i32, i32* @stdin
%24 = call i32 @fgets(i8* %15, i32 65, i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* %15)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %16)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %16)
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}