#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 my_remove(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int data[6] = {3, 23, -7, 8, 9, 10}, i, d, isfound;
  printf("Origin array is:\n");
  for (i = 0; i < 6; i++)
    printf("%d ", data[i]);
  printf("\nPlease input the integer you want to delete:\n");
  scanf("%d", &d);
  isfound = my_remove(data, d);
  if (1 == isfound) {
    printf("After deletion:\n");
    for (i = 0; i < 6; i++) {
      if (0 != data[i])
        printf("%d ", data[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    11a3 <main+0x73>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1175 <main+0x45>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1040 <my_remove@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x1,%eax
cmp    -0x2c(%rbp),%eax
jne    123b <main+0x10b>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    1236 <main+0x106>
movslq -0x24(%rbp),%rcx
xor    %eax,%eax
cmp    -0x20(%rbp,%rcx,4),%eax
je     1223 <main+0xf3>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1228 <main+0xf8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f3 <main+0xc3>
jmp    123b <main+0x10b>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xec4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xfffffff9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1050 <my_remove@plt>
cmp    $0x1,%eax
jne    128e <main+0x14e>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%esi
test   %esi,%esi
je     1220 <main+0xe0>
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
test   %esi,%esi
je     1236 <main+0xf6>
lea    0xde9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
test   %esi,%esi
je     124c <main+0x10c>
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
test   %esi,%esi
je     1262 <main+0x122>
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
test   %esi,%esi
je     1278 <main+0x138>
lea    0xda7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
test   %esi,%esi
je     128e <main+0x14e>
lea    0xd91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.data = [6 x i32] [i32 3, i32 23, i32 -7, i32 8, i32 9, i32 10]
@.str = [18 x i8] c"Origin array is:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [47 x i8] c"\0APlease input the integer you want to delete:\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [17 x i8] c"After deletion:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [6 x i32]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %8
20: ; preds = %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %4
%25 = call i32 @my_remove(i32* %23, i32 %24)
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = icmp eq i32 1, %26
br i1 %27, label %28, label %50
28: ; preds = %20
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %30
30: ; preds = %46, %28
%31 = load i32, i32* %3
%32 = icmp slt i32 %31, 6
br i1 %32, label %33, label %49
33: ; preds = %30
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp ne i32 0, %37
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %39, %33
br label %46
46: ; preds = %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %30
49: ; preds = %30
br label %50
50: ; preds = %49, %20
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = [6 x i32] [i32 3, i32 23, i32 -7, i32 8, i32 9, i32 10]
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [3 x i8] c"%d\00"
@str = [17 x i8] c"Origin array is:\00"
@str.5 = [46 x i8] c"\0APlease input the integer you want to delete:\00"
@str.6 = [16 x i8] c"After deletion:\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = bitcast [6 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 23)
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -7)
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8)
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 9)
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%20 = load i32, i32* %2
%21 = call i32 @my_remove(i32* %6, i32 %20)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %54
23: ; preds = %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %29
29: ; preds = %23, %27
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %10
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %39
39: ; preds = %37, %34
%40 = load i32, i32* %12
%41 = icmp eq i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40)
br label %44
44: ; preds = %42, %39
%45 = load i32, i32* %14
%46 = icmp eq i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %49
49: ; preds = %47, %44
%50 = load i32, i32* %16
%51 = icmp eq i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %54
54: ; preds = %49, %52, %0
ret i32 0
}