#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
void ok_output(char *out) {
  if (strstr(out, ".emp") == NULL) {
    strcat(out, ".emp");
  } else {
    if (strlen(out) <= 4) {
      fprintf(
          stderr,
          "The name cannot be blank.\nDo you want to change the name? Y/N\n");
      char op[1];
      size_t ok_op = 0;
      scanf("%s", op);
      do {
        if (!strcmp(op, "y") || !strcmp(op, "Y")) {
          printf("Enter the new name\n");
          scanf("%s", out);
          ok_op = 1;
          ok_output(out);
        }
        if (!strcmp(op, "n") || !strcmp(op, "N")) {
          fprintf(stderr, "Program stopped\n");
          exit(15);
        }
        fprintf(stderr, "Wrong option.\n");
      } while (ok_op);
    }
  }
}


x86 assembly (clang, -O0):
<ok_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
jne    11cb <ok_output+0x3b>
mov    -0x8(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1080 <strcat@plt>
jmp    12e4 <ok_output+0x154>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
jg     12df <ok_output+0x14f>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
call   1060 <fprintf@plt>
movq   $0x0,-0x18(%rbp)
lea    -0x9(%rbp),%rsi
lea    0xe3f(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x9(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     123c <ok_output+0xac>
lea    -0x9(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1269 <ok_output+0xd9>
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xdf1(%rip),%rdi
call   1070 <scanf@plt>
movq   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <ok_output@plt>
lea    -0x9(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     129b <ok_output+0x10b>
lea    -0x9(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12ba <ok_output+0x12a>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xf,%edi
call   1090 <exit@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
lea    0xdaa(%rip),%rsi
call   1060 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    120a <ok_output+0x7a>
jmp    12df <ok_output+0x14f>
jmp    12e4 <ok_output+0x154>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ok_output>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xe5b(%rip),%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
je     1293 <ok_output+0x103>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
jg     1284 <ok_output+0xf4>
mov    0x2e15(%rip),%r14
mov    (%r14),%edi
lea    0xe30(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xe63(%rip),%rdi
lea    0x7(%rsp),%rbp
mov    %rbp,%rsi
call   1070 <scanf@plt>
lea    0xe52(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1219 <ok_output+0x89>
lea    0xe41(%rip),%rsi
lea    0x7(%rsp),%rdi
call   1050 <strcmp@plt>
mov    $0x1,%bpl
test   %eax,%eax
jne    123e <ok_output+0xae>
lea    0xe4f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe18(%rip),%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   10a0 <ok_output@plt>
xor    %ebp,%ebp
lea    0xe06(%rip),%rsi
lea    0x7(%rsp),%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     133e <ok_output+0x1ae>
lea    0xdef(%rip),%rsi
lea    0x7(%rsp),%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     133e <ok_output+0x1ae>
mov    (%r14),%edi
lea    0xde6(%rip),%rsi
call   1060 <fprintf@plt>
test   %bpl,%bpl
je     12b0 <ok_output+0x120>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd66(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <strcat@plt>
lea    0x7(%rsp),%r15
lea    0xd8f(%rip),%rbp
lea    0xd8a(%rip),%r12
lea    0xd96(%rip),%r13
mov    %r15,%rdi
lea    0xd73(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     12f0 <ok_output+0x160>
mov    %r15,%rdi
lea    0xd62(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    1313 <ok_output+0x183>
lea    0xd78(%rip),%rdi
call   1030 <puts@plt>
lea    0xd41(%rip),%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   10a0 <ok_output@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     133e <ok_output+0x1ae>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     133e <ok_output+0x1ae>
mov    (%r14),%edi
mov    %r13,%rsi
call   1060 <fprintf@plt>
jmp    12ca <ok_output+0x13a>
mov    (%r14),%edi
lea    0xd07(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xf,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c".emp\00"
@stderr = global i32 0
@.str.1 = [63 x i8] c"The name cannot be blank.\0ADo you want to change the name? Y/N\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [2 x i8] c"Y\00"
@.str.5 = [20 x i8] c"Enter the new name\0A\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [2 x i8] c"N\00"
@.str.8 = [17 x i8] c"Program stopped\0A\00"
@.str.9 = [15 x i8] c"Wrong option.\0A\00"
define void @ok_output(i8* %0) {
%2 = alloca i8*
%3 = alloca [1 x i8]
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @strstr(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %53
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = icmp sle i32 %13, 4
br i1 %14, label %15, label %52
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %4
%18 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %48, %15
%21 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %24, %20
%29 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%30 = load i8*, i8** %2
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %30)
store i64 1, i64* %4
%32 = load i8*, i8** %2
br label %33
33: ; preds = %28, %24
%34 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %37, %33
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%44 = call i32 @exit(i32 15)
unreachable
45: ; preds = %37
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %48
48: ; preds = %45
%49 = load i64, i64* %4
%50 = icmp ne i64 %49, 0
br i1 %50, label %20, label %51
51: ; preds = %48
br label %52
52: ; preds = %51, %11
br label %53
53: ; preds = %52, %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".emp\00"
@stderr = global i32 0
@.str.1 = [63 x i8] c"The name cannot be blank.\0ADo you want to change the name? Y/N\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [2 x i8] c"Y\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [2 x i8] c"N\00"
@.str.8 = [17 x i8] c"Program stopped\0A\00"
@.str.9 = [15 x i8] c"Wrong option.\0A\00"
@str = [19 x i8] c"Enter the new name\00"
define void @ok_output(i8* %0) {
%2 = alloca [1 x i8]
%3 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %56
7: ; preds = %1
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %56
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %10
%18 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17, %10
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %23
23: ; preds = %20, %17
%24 = phi i1 [ false, %20 ], [ true, %17 ]
%25 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %48, label %27
27: ; preds = %23
%28 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %48, label %30
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br i1 %24, label %55, label %33
33: ; preds = %30, %52
%34 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36, %33
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %42
42: ; preds = %39, %36
%43 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp eq i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = call i32 @strcmp(i8* %13, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45, %42, %27, %23
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%51 = call i32 @exit(i32 15)
unreachable
52: ; preds = %45
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %33
55: ; preds = %30
br label %56
56: ; preds = %7, %55, %5
ret void
}