#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ system(char *);
int main() {
  system("clear");
  printf("\n");
  printf("*** SYSTEM COMMAND EXAMPLE\n");
  printf("*** developed by fox [11/12/2005]\n");
  printf("\n");
  printf("---------------------------------------------------------------------"
         "---\n");
  printf("questo semplice programma compila il programma helloworld\n");
  printf("premere INVIO per compilare o CTRL+C per uscire");
  getchar();
  printf("---------------------------------------------------------------------"
         "---\n");
  printf("fra tre secondi verrà eseguita la compilazione (CTRL+C per "
         "annullare)\n");
  sleep(1);
  printf("fra due secondi...\n");
  sleep(1);
  printf("fra un secondo...\n");
  sleep(1);
  system("gcc helloworld.c -o helloworld");
  printf("\nsh: gcc helloworld.c -o helloworld\n\n");
  printf("** compilazione eseguita\n");
  sleep(1);
  system("clear");
  printf("---------------------------------------------------------------------"
         "---\n");
  printf("premere INVIO per eseguire il programma o CTRL+C per uscire");
  getchar();
  printf("---------------------------------------------------------------------"
         "---\n");
  printf("\nsh: ./helloworld\n\n");
  printf("---------------------------------------------------------------------"
         "---\n");
  system("./helloworld");
  printf("---------------------------------------------------------------------"
         "---\n");
  printf("\nsh: rm helloworld\n\n");
  system("rm helloworld");
  printf("esecuzione terminata\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <system@plt>
lea    0x10fb(%rip),%rdi
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
lea    0x10d7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
call   1040 <printf@plt>
lea    0xf20(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
lea    0xf31(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xf63(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xf61(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xf5e(%rip),%rdi
call   1030 <system@plt>
lea    0xf71(%rip),%rdi
call   1040 <printf@plt>
lea    0xf8b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    0xdc7(%rip),%rdi
call   1030 <system@plt>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
lea    0xf77(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xde1(%rip),%rdi
call   1040 <printf@plt>
lea    0xf94(%rip),%rdi
call   1040 <printf@plt>
lea    0xdc9(%rip),%rdi
call   1040 <printf@plt>
lea    0xf90(%rip),%rdi
call   1030 <system@plt>
lea    0xdb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xf85(%rip),%rdi
call   1040 <printf@plt>
lea    0xf8e(%rip),%rdi
call   1030 <system@plt>
lea    0xf90(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%r14
mov    %r14,%rdi
call   1050 <system@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf28(%rip),%rdi
call   1040 <puts@plt>
lea    0xf37(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x103a(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xf34(%rip),%rdi
call   1040 <puts@plt>
lea    0xe45(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xf47(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
lea    0xf78(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
lea    0xf75(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
lea    0xe18(%rip),%rdi
call   1050 <system@plt>
lea    0xf65(%rip),%rdi
call   1040 <puts@plt>
lea    0xf7e(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xdf9(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xf56(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe06(%rip),%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xf8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf3(%rip),%rdi
call   1050 <system@plt>
lea    0xf86(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [28 x i8] c"*** SYSTEM COMMAND EXAMPLE\0A\00"
@.str.3 = [35 x i8] c"*** developed by fox [11/12/2005]\0A\00"
@.str.4 = [74 x i8] c"------------------------------------------------------------------------\0A\00"
@.str.5 = [59 x i8] c"questo semplice programma compila il programma helloworld\0A\00"
@.str.6 = [48 x i8] c"premere INVIO per compilare o CTRL+C per uscire\00"
@.str.7 = [72 x i8] c"fra tre secondi verr\C3\A0 eseguita la compilazione (CTRL+C per annullare)\0A\00"
@.str.8 = [20 x i8] c"fra due secondi...\0A\00"
@.str.9 = [19 x i8] c"fra un secondo...\0A\00"
@.str.10 = [31 x i8] c"gcc helloworld.c -o helloworld\00"
@.str.11 = [38 x i8] c"\0Ash: gcc helloworld.c -o helloworld\0A\0A\00"
@.str.12 = [26 x i8] c"** compilazione eseguita\0A\00"
@.str.13 = [60 x i8] c"premere INVIO per eseguire il programma o CTRL+C per uscire\00"
@.str.14 = [20 x i8] c"\0Ash: ./helloworld\0A\0A\00"
@.str.15 = [13 x i8] c"./helloworld\00"
@.str.16 = [21 x i8] c"\0Ash: rm helloworld\0A\0A\00"
@.str.17 = [14 x i8] c"rm helloworld\00"
@.str.18 = [23 x i8] c"esecuzione terminata\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 (...) @getchar()
%11 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 @sleep(i32 1)
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @sleep(i32 1)
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 @sleep(i32 1)
%18 = call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%21 = call i32 @sleep(i32 1)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.13, i64 0, i64 0))
%25 = call i32 (...) @getchar()
%26 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0))
%32 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.6 = [48 x i8] c"premere INVIO per compilare o CTRL+C per uscire\00"
@.str.10 = [31 x i8] c"gcc helloworld.c -o helloworld\00"
@.str.13 = [60 x i8] c"premere INVIO per eseguire il programma o CTRL+C per uscire\00"
@.str.15 = [13 x i8] c"./helloworld\00"
@.str.17 = [14 x i8] c"rm helloworld\00"
@str = [27 x i8] c"*** SYSTEM COMMAND EXAMPLE\00"
@str.19 = [34 x i8] c"*** developed by fox [11/12/2005]\00"
@str.21 = [58 x i8] c"questo semplice programma compila il programma helloworld\00"
@str.23 = [71 x i8] c"fra tre secondi verr\C3\A0 eseguita la compilazione (CTRL+C per annullare)\00"
@str.24 = [19 x i8] c"fra due secondi...\00"
@str.25 = [18 x i8] c"fra un secondo...\00"
@str.26 = [37 x i8] c"\0Ash: gcc helloworld.c -o helloworld\0A\00"
@str.27 = [25 x i8] c"** compilazione eseguita\00"
@str.30 = [19 x i8] c"\0Ash: ./helloworld\0A\00"
@str.32 = [73 x i8] c"------------------------------------------------------------------------\00"
@str.33 = [20 x i8] c"\0Ash: rm helloworld\0A\00"
@str.34 = [22 x i8] c"esecuzione terminata\0A\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.19, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.21, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 (...) @getchar()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.23, i64 0, i64 0))
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.24, i64 0, i64 0))
%14 = tail call i32 @sleep(i32 1)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.25, i64 0, i64 0))
%16 = tail call i32 @sleep(i32 1)
%17 = tail call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.26, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.27, i64 0, i64 0))
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%23 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.13, i64 0, i64 0))
%24 = tail call i32 (...) @getchar()
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.30, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%28 = tail call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.33, i64 0, i64 0))
%31 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.34, i64 0, i64 0))
ret i32 0
}