#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ put(char **, char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int vider(int /*<<< orphan*/ *, char **);
int insert(char m[100][100]) {
  int i = 0;
  char ch[100], sh[100], a[2];
  do {
    printf("*[press "
           "\x1B[32m"
           "1"
           "\x1B[0m"
           " ] you have an input file\n*[press "
           "\x1B[32m"
           "2"
           "\x1B[0m"
           " ] insert them one by one\n\n your choice :   ");
    scanf(" %s", &a);
  } while ((a[0] != '1') && (a[0] != '2'));
  switch (a[0]) {
  case ('1'): {
    FILE *ftxt = NULL;
    do {
      do {
        printf("\x1B[32m"
               "\n(Input_folder)"
               "\x1B[0m"
               " /../filename.txt :   ");
        scanf("%s", sh);
      } while (!fopen(sh, "r+"));
      ftxt = fopen(sh, "r+");
    } while (!ftxt);
    i = vider(ftxt, m);
    return (i);
  } break;
  case ('2'): {
    printf("\nwrite your guesses , at the END write "
           "\x1B[32m"
           "w&q "
           "\x1B[0m");
    do {
      do {
        printf("\nN°[%d] : ", i + 1);
        scanf("%s", ch);
      } while (ch[0] == '\n');
      if ((ch[0] != 'w') || (ch[1] != '&') || (ch[2] != 'q') ||
          (ch[3] != '\0')) {
        put(m, ch, i);
        i++;
      } else
        return (i);
    } while (((ch[0] != 'w') || (ch[1] != '&') || (ch[2] != 'q') ||
              (ch[3] != '\0')));
  } break;
  }
}


x86 assembly (clang, -O0):
<insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
lea    -0xf2(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsbl -0xf2(%rbp),%ecx
xor    %eax,%eax
cmp    $0x31,%ecx
mov    %al,-0x101(%rbp)
je     11b4 <insert+0x64>
movsbl -0xf2(%rbp),%eax
cmp    $0x32,%eax
setne  %al
mov    %al,-0x101(%rbp)
mov    -0x101(%rbp),%al
test   $0x1,%al
jne    1166 <insert+0x16>
movsbl -0xf2(%rbp),%eax
mov    %eax,-0x108(%rbp)
sub    $0x31,%eax
je     11f1 <insert+0xa1>
jmp    11dd <insert+0x8d>
mov    -0x108(%rbp),%eax
sub    $0x32,%eax
je     1295 <insert+0x145>
jmp    139f <insert+0x24f>
movq   $0x0,-0x100(%rbp)
jmp    1201 <insert+0xb1>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xf0(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0xf0(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1060 <fopen@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1201 <insert+0xb1>
lea    -0xf0(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x100(%rbp)
cmpq   $0x0,-0x100(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11fc <insert+0xac>
mov    -0x100(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <vider@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    139f <insert+0x24f>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a8 <insert+0x158>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movsbl -0x80(%rbp),%eax
cmp    $0xa,%eax
je     12a8 <insert+0x158>
movsbl -0x80(%rbp),%eax
cmp    $0x77,%eax
jne    130f <insert+0x1bf>
movsbl -0x7f(%rbp),%eax
cmp    $0x26,%eax
jne    130f <insert+0x1bf>
movsbl -0x7e(%rbp),%eax
cmp    $0x71,%eax
jne    130f <insert+0x1bf>
movsbl -0x7d(%rbp),%eax
cmp    $0x0,%eax
je     132d <insert+0x1dd>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <put@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1338 <insert+0x1e8>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    139f <insert+0x24f>
jmp    133d <insert+0x1ed>
movsbl -0x80(%rbp),%ecx
mov    $0x1,%al
cmp    $0x77,%ecx
mov    %al,-0x109(%rbp)
jne    138c <insert+0x23c>
movsbl -0x7f(%rbp),%ecx
mov    $0x1,%al
cmp    $0x26,%ecx
mov    %al,-0x109(%rbp)
jne    138c <insert+0x23c>
movsbl -0x7e(%rbp),%ecx
mov    $0x1,%al
cmp    $0x71,%ecx
mov    %al,-0x109(%rbp)
jne    138c <insert+0x23c>
movsbl -0x7d(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x109(%rbp)
mov    -0x109(%rbp),%al
test   $0x1,%al
jne    12a3 <insert+0x153>
jmp    139f <insert+0x24f>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%r14
lea    0xe98(%rip),%r15
lea    0xefc(%rip),%rbp
lea    0xe(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movzbl 0xe(%rsp),%eax
lea    -0x33(%rax),%ecx
cmp    $0xfe,%cl
jb     1180 <insert+0x30>
cmp    $0x32,%al
je     121a <insert+0xca>
cmp    $0x31,%al
jne    12ab <insert+0x15b>
lea    0xeb8(%rip),%r15
lea    0xeae(%rip),%r12
lea    0x10(%rsp),%rbx
lea    0xed4(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11d0 <insert+0x80>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11d0 <insert+0x80>
mov    %rax,%rdi
mov    %r14,%rsi
call   1070 <vider@plt>
mov    %eax,%r15d
jmp    12ab <insert+0x15b>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea7(%rip),%r12
lea    0xe36(%rip),%r13
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
jmp    125f <insert+0x10f>
nop
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <put@plt>
movdqa 0x10(%rsp),%xmm0
movd   %xmm0,%eax
cmp    $0x712677,%eax
je     12ab <insert+0x15b>
mov    %ebp,%r15d
lea    0x1(%r15),%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movzbl 0x10(%rsp),%eax
cmp    $0xa,%al
je     1270 <insert+0x120>
cmp    $0x77,%al
jne    1240 <insert+0xf0>
cmpb   $0x26,0x11(%rsp)
jne    1240 <insert+0xf0>
cmpb   $0x71,0x12(%rsp)
jne    1240 <insert+0xf0>
cmpb   $0x0,0x13(%rsp)
jne    1240 <insert+0xf0>
mov    %r15d,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [107 x i8] c"*[press \1B[32m1\1B[0m ] you have an input file\0A*[press \1B[32m2\1B[0m ] insert them one by one\0A\0A your choice : \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [47 x i8] c"\1B[32m\0A(Input_folder)\1B[0m /../filename.txt : \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [3 x i8] c"r+\00"
@.str.5 = [53 x i8] c"\0Awrite your guesses , at the END write \1B[32mw&q \1B[0m\00"
@.str.6 = [12 x i8] c"\0AN\C2\B0[%d] : \00"
define i32 @insert([100 x i8]* %0) {
%2 = alloca i32
%3 = alloca [100 x i8]*
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca [2 x i8]
%8 = alloca i32*
store [100 x i8]* %0, [100 x i8]** %3
store i32 0, i32* %4
br label %9
9: ; preds = %22, %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), [2 x i8]* %7)
br label %12
12: ; preds = %9
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 49
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 50
br label %22
22: ; preds = %17, %12
%23 = phi i1 [ false, %12 ], [ %21, %17 ]
br i1 %23, label %9, label %24
24: ; preds = %22
%25 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
switch i32 %27, label %120 [
i32 49, label %28
i32 50, label %52
]
28: ; preds = %24
store i32* null, i32** %8
br label %29
29: ; preds = %42, %28
br label %30
30: ; preds = %34, %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %30
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp ne i32* %36, null
%38 = xor i1 %37, true
br i1 %38, label %30, label %39
39: ; preds = %34
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %41, i32** %8
br label %42
42: ; preds = %39
%43 = load i32*, i32** %8
%44 = icmp ne i32* %43, null
%45 = xor i1 %44, true
br i1 %45, label %29, label %46
46: ; preds = %42
%47 = load i32*, i32** %8
%48 = load [100 x i8]*, [100 x i8]** %3
%49 = bitcast [100 x i8]* %48 to i8**
%50 = call i32 @vider(i32* %47, i8** %49)
store i32 %50, i32* %4
%51 = load i32, i32* %4
store i32 %51, i32* %2
br label %120
52: ; preds = %24
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %117, %52
br label %55
55: ; preds = %61, %54
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%60 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %55
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 10
br i1 %65, label %55, label %66
66: ; preds = %61
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp ne i32 %69, 119
br i1 %70, label %86, label %71
71: ; preds = %66
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 1
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp ne i32 %74, 38
br i1 %75, label %86, label %76
76: ; preds = %71
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 2
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp ne i32 %79, 113
br i1 %80, label %86, label %81
81: ; preds = %76
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 3
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %94
86: ; preds = %81, %76, %71, %66
%87 = load [100 x i8]*, [100 x i8]** %3
%88 = bitcast [100 x i8]* %87 to i8**
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%90 = load i32, i32* %4
%91 = call i32 @put(i8** %88, i8* %89, i32 %90)
%92 = load i32, i32* %4
%93 = add nsw i32 %92, 1
store i32 %93, i32* %4
br label %96
94: ; preds = %81
%95 = load i32, i32* %4
store i32 %95, i32* %2
br label %120
96: ; preds = %86
br label %97
97: ; preds = %96
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp ne i32 %100, 119
br i1 %101, label %117, label %102
102: ; preds = %97
%103 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 1
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 38
br i1 %106, label %117, label %107
107: ; preds = %102
%108 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 2
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = icmp ne i32 %110, 113
br i1 %111, label %117, label %112
112: ; preds = %107
%113 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 3
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp ne i32 %115, 0
br label %117
117: ; preds = %112, %107, %102, %97
%118 = phi i1 [ true, %107 ], [ true, %102 ], [ true, %97 ], [ %116, %112 ]
br i1 %118, label %54, label %119
119: ; preds = %117
br label %120
120: ; preds = %46, %94, %24, %119
%121 = load i32, i32* %2
ret i32 %121
}

LLVM IR (-O2):
@.str = [107 x i8] c"*[press \1B[32m1\1B[0m ] you have an input file\0A*[press \1B[32m2\1B[0m ] insert them one by one\0A\0A your choice : \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [47 x i8] c"\1B[32m\0A(Input_folder)\1B[0m /../filename.txt : \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [3 x i8] c"r+\00"
@.str.5 = [53 x i8] c"\0Awrite your guesses , at the END write \1B[32mw&q \1B[0m\00"
@.str.6 = [12 x i8] c"\0AN\C2\B0[%d] : \00"
define i32 @insert([100 x i8]* %0) {
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
br label %8
8: ; preds = %8, %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), [2 x i8]* %4)
%11 = load i8, i8* %7
%12 = add i8 %11, -51
%13 = icmp ult i8 %12, -2
br i1 %13, label %8, label %14
14: ; preds = %8
switch i8 %11, label %59 [
i8 49, label %15
i8 50, label %27
]
15: ; preds = %14, %20
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%18 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %21
20: ; preds = %15, %21
br label %15
21: ; preds = %15
%22 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %20, label %24
24: ; preds = %21
%25 = bitcast [100 x i8]* %0 to i8**
%26 = call i32 @vider(i32* %22, i8** %25)
br label %59
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 1
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 2
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 3
%32 = bitcast [100 x i8]* %0 to i8**
%33 = bitcast [100 x i8]* %2 to <4 x i8>*
br label %34
34: ; preds = %53, %27
%35 = phi i32 [ 0, %27 ], [ %36, %53 ]
%36 = add nuw nsw i32 %35, 1
br label %37
37: ; preds = %37, %34
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %36)
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%40 = load i8, i8* %5
%41 = icmp eq i8 %40, 10
br i1 %41, label %37, label %42
42: ; preds = %37
%43 = icmp ne i8 %40, 119
%44 = load i8, i8* %29
%45 = icmp ne i8 %44, 38
%46 = select i1 %43, i1 true, i1 %45
%47 = load i8, i8* %30
%48 = icmp ne i8 %47, 113
%49 = select i1 %46, i1 true, i1 %48
%50 = load i8, i8* %31
%51 = icmp ne i8 %50, 0
%52 = select i1 %49, i1 true, i1 %51
br i1 %52, label %53, label %59
53: ; preds = %42
%54 = call i32 @put(i8** %32, i8* %5, i32 %35)
%55 = load <4 x i8>, <4 x i8>* %33
%56 = freeze <4 x i8> %55
%57 = bitcast <4 x i8> %56 to i32
%58 = icmp eq i32 %57, 7415415
br i1 %58, label %59, label %34
59: ; preds = %53, %42, %14, %24
%60 = phi i32 [ %26, %24 ], [ undef, %14 ], [ %35, %42 ], [ %35, %53 ]
ret i32 %60
}