#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*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int strlen(char *);
void del(char *str1, char ch) {
  int j = 0;
  char str2[10];
  for (int i = 0; i < strlen(str1); i++) {
    if (str1[i] != ch) {
      str2[j] = str1[i];
      j++;
    }
  }
  str2[j] = '\0';
  printf("\nCorrected string:");
  puts(str2);
}


x86 assembly (clang, -O0):
<del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    11b3 <del+0x83>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     11a0 <del+0x70>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x1a(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a5 <del+0x75>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1150 <del+0x20>
movslq -0x10(%rbp),%rax
movb   $0x0,-0x1a(%rbp,%rax,1)
lea    0xe3d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1a(%rbp),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %rdi,%r15
call   1040 <strlen@plt>
test   %eax,%eax
jle    1179 <del+0x49>
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1163 <del+0x33>
nop
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    117b <del+0x4b>
movzbl (%r15,%rbx,1),%eax
cmp    %r14b,%al
je     1150 <del+0x20>
movslq %ebp,%rbp
mov    %al,0xe(%rsp,%rbp,1)
add    $0x1,%ebp
jmp    1150 <del+0x20>
xor    %ebp,%ebp
movslq %ebp,%rax
movb   $0x0,0xe(%rsp,%rax,1)
lea    0xe76(%rip),%rdi
call   1050 <printf@plt>
lea    0xe(%rsp),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0ACorrected string:\00"
define void @del(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
%6 = alloca [10 x i8]
%7 = alloca i32
store i8* %0, i8** %3
store i8 %1, i8* %4
store i32 0, i32* %5
store i32 0, i32* %7
br label %8
8: ; preds = %35, %2
%9 = load i32, i32* %7
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %38
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %19, %21
br i1 %22, label %23, label %34
23: ; preds = %13
%24 = load i8*, i8** %3
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 %30
store i8 %28, i8* %31
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %34
34: ; preds = %23, %13
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %8
38: ; preds = %8
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 %40
store i8 0, i8* %41
%42 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%44 = call i32 @puts(i8* %43)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0ACorrected string:\00"
define void @del(i8* %0, i8 signext %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %23, %2
%8 = phi i32 [ 0, %2 ], [ %24, %23 ]
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %9
store i8 0, i8* %10
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @puts(i8* %4)
ret void
13: ; preds = %2, %23
%14 = phi i64 [ %25, %23 ], [ 0, %2 ]
%15 = phi i32 [ %24, %23 ], [ 0, %2 ]
%16 = getelementptr inbounds i8, i8* %0, i64 %14
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, %1
br i1 %18, label %23, label %19
19: ; preds = %13
%20 = sext i32 %15 to i64
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %20
store i8 %17, i8* %21
%22 = add nsw i32 %15, 1
br label %23
23: ; preds = %13, %19
%24 = phi i32 [ %22, %19 ], [ %15, %13 ]
%25 = add nuw nsw i64 %14, 1
%26 = tail call i32 @strlen(i8* %0)
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %13, label %7
}