#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ first(char *, char);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
scalar_t__ last(char *, char);
int lines(char *);
void *malloc(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ remove(char *);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
char *substr2(char *, int, scalar_t__);
void rem(char *c) {
  FILE *file = fopen("~/.ccmd", "r");
  int i = 0;
  int L = lines("~/.ccmd");
  char ***M = malloc(sizeof(char **) * L);
  for (i = 0; i < L; i++)
    M[i] = malloc(sizeof(char *) * 2);
  if (file != NULL) {
    char line[4096] = "";
    char *line2 = 0;
    char *ccmd = 0;
    char *cmd = 0;
    while (fgets(line, sizeof line, file) != NULL) {
      line2 = strstr(line, " ");
      ccmd = substr2(line2, 1, first(line2, '=') - 1);
      line2 = strstr(line2, "\"");
      cmd = substr2(line2, 1, last(line2, '\"'));
      M[i][0] = malloc(sizeof(char) * 512);
      strcpy(M[i][0], ccmd);
      M[i][1] = malloc(sizeof(char) * 1536);
      strcpy(M[i][1], cmd);
      i++;
    }
    fclose(file);
  } else {
    printf(" Error: an error occured reading ccmd file \n");
    return;
  }
  file = fopen("~/t.txt", "w");
  if (file != NULL) {
    int i = 0;
    while (i < L) {
      if (M[i][0] == c) {
        fprintf(file, "alias %s=\"%s\";\n", M[i][0], M[i][1]);
      }
      i++;
    }
    fclose(file);
    if (remove("~/.ccmd") == 0) {
      if (rename("~/t.txt", "~/.ccmd") != 0) {
        printf("Error: new ccmd couldn't be placed, check t file");
        return;
      }
    } else {
      printf("Error: old ccmd file couldn't be deleted");
      return;
    }
  } else {
    printf(" Error: an error occured reading ccmd file \n");
    return;
  }
  printf("\n Custom command removed successfully \n\n");
}


x86 assembly (clang, -O0):
<rem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xdfa(%rip),%rdi
lea    0xdfb(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xddc(%rip),%rdi
call   10f0 <lines@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1279 <rem+0x89>
mov    $0x10,%edi
call   10b0 <malloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1246 <rem+0x56>
cmpq   $0x0,-0x10(%rbp)
je     140f <rem+0x21f>
lea    -0x1020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1080 <memset@plt>
movq   $0x0,-0x1028(%rbp)
movq   $0x0,-0x1030(%rbp)
movq   $0x0,-0x1038(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1000,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     1401 <rem+0x211>
lea    -0x1020(%rbp),%rdi
lea    0xd25(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x1028(%rbp)
mov    -0x1028(%rbp),%rax
mov    %rax,-0x1050(%rbp)
mov    -0x1028(%rbp),%rdi
mov    $0x3d,%esi
call   1110 <first@plt>
mov    -0x1050(%rbp),%rdi
mov    %rax,%rdx
sub    $0x1,%rdx
mov    $0x1,%esi
call   10c0 <substr2@plt>
mov    %rax,-0x1030(%rbp)
mov    -0x1028(%rbp),%rdi
lea    0xccf(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x1028(%rbp)
mov    -0x1028(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    -0x1028(%rbp),%rdi
mov    $0x22,%esi
call   1070 <last@plt>
mov    -0x1048(%rbp),%rdi
mov    %rax,%rdx
mov    $0x1,%esi
call   10c0 <substr2@plt>
mov    %rax,-0x1038(%rbp)
mov    $0x200,%edi
call   10b0 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rdi
mov    -0x1030(%rbp),%rsi
call   1040 <strcpy@plt>
mov    $0x600,%edi
call   10b0 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%rdi
mov    -0x1038(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12b8 <rem+0xc8>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
jmp    1420 <rem+0x230>
lea    0xbf8(%rip),%rdi
call   1060 <printf@plt>
jmp    1545 <rem+0x355>
lea    0xc14(%rip),%rdi
lea    0xc15(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1528 <rem+0x338>
movl   $0x0,-0x103c(%rbp)
mov    -0x103c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    14c0 <rem+0x2d0>
mov    -0x20(%rbp),%rax
movslq -0x103c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rax
cmp    -0x8(%rbp),%rax
jne    14ac <rem+0x2bc>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x103c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rax
movslq -0x103c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%rcx
lea    0xb9e(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x103c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x103c(%rbp)
jmp    144c <rem+0x25c>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xb30(%rip),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jne    1512 <rem+0x322>
lea    0xb55(%rip),%rdi
lea    0xb13(%rip),%rsi
call   10e0 <rename@plt>
cmp    $0x0,%rax
je     150d <rem+0x31d>
lea    0xb52(%rip),%rdi
call   1060 <printf@plt>
jmp    1545 <rem+0x355>
jmp    1523 <rem+0x333>
lea    0xb6d(%rip),%rdi
call   1060 <printf@plt>
jmp    1545 <rem+0x355>
jmp    1539 <rem+0x349>
lea    0xadf(%rip),%rdi
call   1060 <printf@plt>
jmp    1545 <rem+0x355>
lea    0xb6f(%rip),%rdi
call   1060 <printf@plt>
add    $0x1050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
mov    %rdi,%r14
lea    0xde5(%rip),%rbp
lea    0xde6(%rip),%rsi
mov    %rbp,%rdi
call   10f0 <fopen@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1110 <lines@plt>
mov    %eax,%r15d
lea    0x0(,%r15,8),%edi
call   10d0 <malloc@plt>
mov    %rax,%rbp
test   %r15d,%r15d
jle    142d <rem+0x22d>
mov    %rbx,%r13
mov    %r15d,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    $0x10,%edi
call   10d0 <malloc@plt>
mov    %rax,0x0(%rbp,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1260 <rem+0x60>
mov    %r13,%rbx
test   %rbx,%rbx
je     1439 <rem+0x239>
mov    %rbp,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
lea    0x20(%rsp),%r13
mov    $0x1000,%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10a0 <memset@plt>
mov    %r13,%rdi
mov    $0x1000,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     138d <rem+0x18d>
mov    0x8(%rsp),%rax
lea    (%rax,%r12,8),%r14
nopl   0x0(%rax)
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0x3d,%esi
call   1120 <first@plt>
lea    -0x1(%rax),%rdx
mov    %rbp,%rdi
mov    $0x1,%esi
call   10e0 <substr2@plt>
mov    %rax,%r15
mov    %rbp,%rdi
mov    $0x22,%esi
call   1070 <strchr@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0x22,%esi
call   1090 <last@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
call   10e0 <substr2@plt>
mov    %rax,%rbp
mov    $0x200,%edi
call   10d0 <malloc@plt>
mov    %rbx,%r13
mov    (%r14),%rbx
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    $0x600,%edi
call   10d0 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    %r13,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %r13,%rdx
call   10b0 <fgets@plt>
add    $0x8,%r14
test   %rax,%rax
jne    12d0 <rem+0xd0>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xc6e(%rip),%rdi
lea    0xc6f(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1456 <rem+0x256>
mov    %rax,%r14
mov    0x10(%rsp),%rax
test   %eax,%eax
mov    0x18(%rsp),%rbp
mov    0x8(%rsp),%r12
jle    1406 <rem+0x206>
mov    %eax,%r13d
xor    %ebx,%ebx
lea    0xc41(%rip),%r15
jmp    13e9 <rem+0x1e9>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    %rbx,%r13
je     1406 <rem+0x206>
mov    (%r12,%rbx,8),%rax
cmp    %rbp,(%rax)
jne    13e0 <rem+0x1e0>
mov    0x8(%rax),%rcx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   10c0 <fprintf@plt>
jmp    13e0 <rem+0x1e0>
mov    %r14,%rdi
call   1060 <fclose@plt>
lea    0xbeb(%rip),%rdi
call   1030 <remove@plt>
test   %rax,%rax
je     145f <rem+0x25f>
lea    0xc2f(%rip),%rdi
call   1080 <printf@plt>
jmp    1491 <rem+0x291>
xor    %r12d,%r12d
test   %rbx,%rbx
jne    1284 <rem+0x84>
lea    0xc3e(%rip),%rdi
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <puts@plt>
lea    0xc21(%rip),%rdi
jmp    148c <rem+0x28c>
lea    0xba4(%rip),%rdi
lea    0xb93(%rip),%rsi
call   1100 <rename@plt>
test   %rax,%rax
je     1485 <rem+0x285>
lea    0xba6(%rip),%rdi
call   1080 <printf@plt>
jmp    1491 <rem+0x291>
lea    0xc1e(%rip),%rdi
call   1050 <puts@plt>
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"~/.ccmd\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"\22\00"
@.str.4 = [45 x i8] c" Error: an error occured reading ccmd file \0A\00"
@.str.5 = [8 x i8] c"~/t.txt\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [16 x i8] c"alias %s=\22%s\22;\0A\00"
@.str.8 = [49 x i8] c"Error: new ccmd couldn't be placed, check t file\00"
@.str.9 = [41 x i8] c"Error: old ccmd file couldn't be deleted\00"
@.str.10 = [41 x i8] c"\0A Custom command removed successfully \0A\0A\00"
define void @rem(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8***
%7 = alloca [4096 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
store i8* %0, i8** %2
%12 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %3
store i32 0, i32* %4
%13 = call i32 @lines(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = mul i64 8, %15
%17 = trunc i64 %16 to i32
%18 = call i8* @malloc(i32 %17)
%19 = bitcast i8* %18 to i8***
store i8*** %19, i8**** %6
store i32 0, i32* %4
br label %20
20: ; preds = %31, %1
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = call i8* @malloc(i32 16)
%26 = bitcast i8* %25 to i8**
%27 = load i8***, i8**** %6
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8**, i8*** %27, i64 %29
store i8** %26, i8*** %30
br label %31
31: ; preds = %24
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %20
34: ; preds = %20
%35 = load i32*, i32** %3
%36 = icmp ne i32* %35, null
br i1 %36, label %37, label %95
37: ; preds = %34
%38 = bitcast [4096 x i8]* %7 to i8*
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
br label %39
39: ; preds = %44, %37
%40 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%41 = load i32*, i32** %3
%42 = call i32* @fgets(i8* %40, i32 4096, i32* %41)
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %92
44: ; preds = %39
%45 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%46 = call i8* @strstr(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %46, i8** %8
%47 = load i8*, i8** %8
%48 = load i8*, i8** %8
%49 = call i64 @first(i8* %48, i8 signext 61)
%50 = sub nsw i64 %49, 1
%51 = call i8* @substr2(i8* %47, i32 1, i64 %50)
store i8* %51, i8** %9
%52 = load i8*, i8** %8
%53 = call i8* @strstr(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %53, i8** %8
%54 = load i8*, i8** %8
%55 = load i8*, i8** %8
%56 = call i64 @last(i8* %55, i8 signext 34)
%57 = call i8* @substr2(i8* %54, i32 1, i64 %56)
store i8* %57, i8** %10
%58 = call i8* @malloc(i32 512)
%59 = load i8***, i8**** %6
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8**, i8*** %59, i64 %61
%63 = load i8**, i8*** %62
%64 = getelementptr inbounds i8*, i8** %63, i64 0
store i8* %58, i8** %64
%65 = load i8***, i8**** %6
%66 = load i32, i32* %4
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8**, i8*** %65, i64 %67
%69 = load i8**, i8*** %68
%70 = getelementptr inbounds i8*, i8** %69, i64 0
%71 = load i8*, i8** %70
%72 = load i8*, i8** %9
%73 = call i32 @strcpy(i8* %71, i8* %72)
%74 = call i8* @malloc(i32 1536)
%75 = load i8***, i8**** %6
%76 = load i32, i32* %4
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8**, i8*** %75, i64 %77
%79 = load i8**, i8*** %78
%80 = getelementptr inbounds i8*, i8** %79, i64 1
store i8* %74, i8** %80
%81 = load i8***, i8**** %6
%82 = load i32, i32* %4
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8**, i8*** %81, i64 %83
%85 = load i8**, i8*** %84
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = load i8*, i8** %10
%89 = call i32 @strcpy(i8* %87, i8* %88)
%90 = load i32, i32* %4
%91 = add nsw i32 %90, 1
store i32 %91, i32* %4
br label %39
92: ; preds = %39
%93 = load i32*, i32** %3
%94 = call i32 @fclose(i32* %93)
br label %97
95: ; preds = %34
%96 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %154
97: ; preds = %92
%98 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %98, i32** %3
%99 = load i32*, i32** %3
%100 = icmp ne i32* %99, null
br i1 %100, label %101, label %150
101: ; preds = %97
store i32 0, i32* %11
br label %102
102: ; preds = %133, %101
%103 = load i32, i32* %11
%104 = load i32, i32* %5
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %136
106: ; preds = %102
%107 = load i8***, i8**** %6
%108 = load i32, i32* %11
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8**, i8*** %107, i64 %109
%111 = load i8**, i8*** %110
%112 = getelementptr inbounds i8*, i8** %111, i64 0
%113 = load i8*, i8** %112
%114 = load i8*, i8** %2
%115 = icmp eq i8* %113, %114
br i1 %115, label %116, label %133
116: ; preds = %106
%117 = load i32*, i32** %3
%118 = load i8***, i8**** %6
%119 = load i32, i32* %11
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8**, i8*** %118, i64 %120
%122 = load i8**, i8*** %121
%123 = getelementptr inbounds i8*, i8** %122, i64 0
%124 = load i8*, i8** %123
%125 = load i8***, i8**** %6
%126 = load i32, i32* %11
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8**, i8*** %125, i64 %127
%129 = load i8**, i8*** %128
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = call i32 @fprintf(i32* %117, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %124, i8* %131)
br label %133
133: ; preds = %116, %106
%134 = load i32, i32* %11
%135 = add nsw i32 %134, 1
store i32 %135, i32* %11
br label %102
136: ; preds = %102
%137 = load i32*, i32** %3
%138 = call i32 @fclose(i32* %137)
%139 = call i64 @remove(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %136
%142 = call i64 @rename(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%143 = icmp ne i64 %142, 0
br i1 %143, label %144, label %146
144: ; preds = %141
%145 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
br label %154
146: ; preds = %141
br label %149
147: ; preds = %136
%148 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0))
br label %154
149: ; preds = %146
br label %152
150: ; preds = %97
%151 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %154
152: ; preds = %149
%153 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0))
br label %154
154: ; preds = %152, %150, %147, %144, %95
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"~/.ccmd\00"
@.str.1 = [2 x i8] c"r\00"
@.str.5 = [8 x i8] c"~/t.txt\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [16 x i8] c"alias %s=\22%s\22;\0A\00"
@.str.8 = [49 x i8] c"Error: new ccmd couldn't be placed, check t file\00"
@.str.9 = [41 x i8] c"Error: old ccmd file couldn't be deleted\00"
@str.11 = [44 x i8] c" Error: an error occured reading ccmd file \00"
@str.12 = [40 x i8] c"\0A Custom command removed successfully \0A\00"
define void @rem(i8* readnone %0) {
%2 = alloca [4096 x i8]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @lines(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = shl i32 %4, 3
%6 = tail call i8* @malloc(i32 %5)
%7 = bitcast i8* %6 to i8***
%8 = icmp sgt i32 %4, 0
br i1 %8, label %9, label %20
9: ; preds = %1
%10 = zext i32 %4 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%14 = getelementptr inbounds i8**, i8*** %7, i64 %12
%15 = bitcast i8*** %14 to i8**
store i8* %13, i8** %15
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11
%19 = zext i32 %4 to i64
br label %20
20: ; preds = %18, %1
%21 = phi i64 [ 0, %1 ], [ %19, %18 ]
%22 = icmp eq i32* %3, null
br i1 %22, label %53, label %23
23: ; preds = %20
%24 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%25 = call i32* @fgets(i8* %24, i32 4096, i32* %3)
%26 = icmp eq i32* %25, null
br i1 %26, label %46, label %27
27: ; preds = %23, %27
%28 = phi i64 [ %43, %27 ], [ %21, %23 ]
%29 = call i8* @strchr(i8* %24, i32 32)
%30 = call i64 @first(i8* %29, i8 signext 61)
%31 = add nsw i64 %30, -1
%32 = call i8* @substr2(i8* %29, i32 1, i64 %31)
%33 = call i8* @strchr(i8* dereferenceable(1) %29, i32 34)
%34 = call i64 @last(i8* %33, i8 signext 34)
%35 = call i8* @substr2(i8* %33, i32 1, i64 %34)
%36 = call dereferenceable_or_null(512) i8* @malloc(i32 512)
%37 = getelementptr inbounds i8**, i8*** %7, i64 %28
%38 = load i8**, i8*** %37
store i8* %36, i8** %38
%39 = call i32 @strcpy(i8* %36, i8* %32)
%40 = call dereferenceable_or_null(1536) i8* @malloc(i32 1536)
%41 = getelementptr inbounds i8*, i8** %38, i64 1
store i8* %40, i8** %41
%42 = call i32 @strcpy(i8* %40, i8* %35)
%43 = add nuw i64 %28, 1
%44 = call i32* @fgets(i8* %24, i32 4096, i32* %3)
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %27
46: ; preds = %27, %23
%47 = call i32 @fclose(i32* %3)
%48 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %79, label %50
50: ; preds = %46
br i1 %8, label %51, label %68
51: ; preds = %50
%52 = zext i32 %4 to i64
br label %55
53: ; preds = %20
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
br label %83
55: ; preds = %51, %65
%56 = phi i64 [ 0, %51 ], [ %66, %65 ]
%57 = getelementptr inbounds i8**, i8*** %7, i64 %56
%58 = load i8**, i8*** %57
%59 = load i8*, i8** %58
%60 = icmp eq i8* %59, %0
br i1 %60, label %61, label %65
61: ; preds = %55
%62 = getelementptr inbounds i8*, i8** %58, i64 1
%63 = load i8*, i8** %62
%64 = call i32 @fprintf(i32* %48, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %0, i8* %63)
br label %65
65: ; preds = %61, %55
%66 = add nuw nsw i64 %56, 1
%67 = icmp eq i64 %66, %52
br i1 %67, label %68, label %55
68: ; preds = %65, %50
%69 = call i32 @fclose(i32* %48)
%70 = call i64 @remove(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %68
%73 = call i64 @rename(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %81, label %75
75: ; preds = %72
%76 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
br label %83
77: ; preds = %68
%78 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0))
br label %83
79: ; preds = %46
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
br label %83
81: ; preds = %72
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.12, i64 0, i64 0))
br label %83
83: ; preds = %75, %77, %81, %79, %53
ret void
}