#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_line(char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ system(char *);
int main(int argc, const char *argv[]) {
  system("pause");
  ;
  char str[8 + 1];
  char command[6 + 8 + 4 + 1];
  if (argc > 1)
    strcpy(str, argv[1]);
  else {
    printf("Input nome programma: ");
    read_line(str, 8 + 1);
  }
  strcpy(command, "tasm ");
  strcat(command, str);
  strcat(command, ".asm");
  system(command);
  system("pause");
  ;
  strcpy(command, "tlink ");
  strcat(command, str);
  strcat(command, ".obj");
  system(command);
  system("pause");
  ;
  printf("TD [0] or LAUNCH [tasto a caso]: ");
  while (getchar() == '\n')
    ;
  if (getchar() == '0') {
    strcpy(command, "td ");
    strcat(command, str);
    strcat(command, ".exe");
    system(command);
  } else
    system(command);
  system("pause");
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1040 <system@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11a2 <main+0x42>
lea    -0x19(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
jmp    11bc <main+0x5c>
lea    0xe5d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x19(%rbp),%rdi
mov    $0x9,%esi
call   1070 <read_line@plt>
lea    -0x30(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x30(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x30(%rbp),%rdi
call   1040 <system@plt>
lea    0xe07(%rip),%rdi
call   1040 <system@plt>
lea    -0x30(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x30(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x30(%rbp),%rdi
call   1040 <system@plt>
lea    0xdc5(%rip),%rdi
call   1040 <system@plt>
lea    0xded(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    1264 <main+0x104>
jmp    124c <main+0xec>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0x30,%eax
jne    12b2 <main+0x152>
lea    -0x30(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x30(%rbp),%rdi
lea    0xdbb(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x30(%rbp),%rdi
call   1040 <system@plt>
jmp    12bb <main+0x15b>
lea    -0x30(%rbp),%rdi
call   1040 <system@plt>
lea    0xd3e(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe8c(%rip),%rdi
call   1040 <system@plt>
cmp    $0x2,%ebp
jl     118e <main+0x2e>
mov    0x8(%rbx),%rsi
lea    0x7(%rsp),%rdi
call   1030 <strcpy@plt>
jmp    11a9 <main+0x49>
lea    0xe71(%rip),%rdi
call   1050 <printf@plt>
lea    0x7(%rsp),%rdi
mov    $0x9,%esi
call   1070 <read_line@plt>
lea    0xe6d(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0x7(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xe4f(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe15(%rip),%rbp
mov    %rbp,%rdi
call   1040 <system@plt>
lea    0xe2e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xe1b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbp,%rdi
call   1040 <system@plt>
lea    0xe01(%rip),%rdi
call   1050 <printf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     1240 <main+0xe0>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x30,%al
jne    1286 <main+0x126>
lea    0xdf9(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0x7(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
lea    0xddc(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
lea    0x10(%rsp),%rdi
call   1040 <system@plt>
lea    0xd69(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"pause\00"
@.str.1 = [23 x i8] c"Input nome programma: \00"
@.str.2 = [6 x i8] c"tasm \00"
@.str.3 = [5 x i8] c".asm\00"
@.str.4 = [7 x i8] c"tlink \00"
@.str.5 = [5 x i8] c".obj\00"
@.str.6 = [34 x i8] c"TD [0] or LAUNCH [tasto a caso]: \00"
@.str.7 = [4 x i8] c"td \00"
@.str.8 = [5 x i8] c".exe\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8]
%7 = alloca [19 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strcpy(i8* %12, i8* %15)
br label %21
17: ; preds = %2
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%20 = call i32 @read_line(i8* %19, i32 9)
br label %21
21: ; preds = %17, %11
%22 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%24 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%25 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%29 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%30 = call i32 @system(i8* %29)
%31 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%32 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%34 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%35 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%36 = call i32 @strcat(i8* %34, i8* %35)
%37 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%38 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%39 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%40 = call i32 @system(i8* %39)
%41 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %43
43: ; preds = %47, %21
%44 = call signext i8 (...) @getchar()
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 10
br i1 %46, label %47, label %48
47: ; preds = %43
br label %43
48: ; preds = %43
%49 = call signext i8 (...) @getchar()
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 48
br i1 %51, label %52, label %62
52: ; preds = %48
%53 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%54 = call i32 @strcpy(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%55 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%56 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%57 = call i32 @strcat(i8* %55, i8* %56)
%58 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%59 = call i32 @strcat(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%60 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%61 = call i32 @system(i8* %60)
br label %65
62: ; preds = %48
%63 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%64 = call i32 @system(i8* %63)
br label %65
65: ; preds = %62, %52
%66 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"pause\00"
@.str.1 = [23 x i8] c"Input nome programma: \00"
@.str.2 = [6 x i8] c"tasm \00"
@.str.3 = [5 x i8] c".asm\00"
@.str.4 = [7 x i8] c"tlink \00"
@.str.5 = [5 x i8] c".obj\00"
@.str.6 = [34 x i8] c"TD [0] or LAUNCH [tasto a caso]: \00"
@.str.7 = [4 x i8] c"td \00"
@.str.8 = [5 x i8] c".exe\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [9 x i8]
%4 = alloca [19 x i8]
%5 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcpy(i8* %6, i8* %11)
br label %16
13: ; preds = %2
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @read_line(i8* %6, i32 9)
br label %16
16: ; preds = %13, %9
%17 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @strcat(i8* %7, i8* %6)
%19 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @system(i8* %7)
%21 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @strcat(i8* %7, i8* %6)
%24 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 @system(i8* %7)
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %28
28: ; preds = %28, %16
%29 = call signext i8 (...) @getchar()
%30 = icmp eq i8 %29, 10
br i1 %30, label %28, label %31
31: ; preds = %28
%32 = call signext i8 (...) @getchar()
%33 = icmp eq i8 %32, 48
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 @strcat(i8* %7, i8* %6)
%37 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %38
38: ; preds = %31, %34
%39 = call i32 @system(i8* %7)
%40 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}