#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 del_substr(char *, char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main(void) {
  char string[100];
  char substring[10];
  int x = 0;
  puts("\n\tSay something nice");
  fgets(string, 100, stdin);
  puts("\n\tNow what block of letters do you want deleted?\n");
  fgets(substring, 10, stdin);
  while (string[x] != '\0')
    printf("%p says %c\n", &string[x], string[x++]);
  return (del_substr(string, substring));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x80(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
lea    -0x7a(%rbp),%rdi
mov    0x2e55(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1050 <fgets@plt>
movslq -0x80(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11df <main+0x9f>
movslq -0x80(%rbp),%rax
lea    -0x70(%rbp),%rsi
add    %rax,%rsi
mov    -0x80(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp)
cltq
lea    0xe77(%rip),%rdi
movsbl -0x70(%rbp,%rax,1),%edx
call   1040 <printf@plt>
jmp    119f <main+0x5f>
lea    -0x70(%rbp),%rdi
lea    -0x7a(%rbp),%rsi
call   1060 <del_substr@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e8e(%rip),%r14
mov    (%r14),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%edx
lea    0x6(%rsp),%rdi
mov    $0xa,%esi
call   1050 <fgets@plt>
mov    0x10(%rsp),%al
test   %al,%al
je     11ba <main+0x7a>
lea    0xeab(%rip),%r14
nopl   0x0(%rax)
movsbl %al,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11a0 <main+0x60>
lea    0x10(%rsp),%rdi
lea    0x6(%rsp),%rsi
call   1060 <del_substr@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0A\09Say something nice\00"
@stdin = global i32 0
@.str.1 = [50 x i8] c"\0A\09Now what block of letters do you want deleted?\0A\00"
@.str.2 = [12 x i8] c"%p says %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [10 x i8]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 100, i32 %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 10, i32 %11)
br label %13
13: ; preds = %20, %0
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %13
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8 signext %28)
br label %13
30: ; preds = %13
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%33 = call i32 @del_substr(i8* %31, i8* %32)
ret i32 %33
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0A\09Say something nice\00"
@stdin = global i32 0
@.str.1 = [50 x i8] c"\0A\09Now what block of letters do you want deleted?\0A\00"
@.str.2 = [12 x i8] c"%p says %c\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 100, i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %4, i32 10, i32 %9)
%11 = load i8, i8* %3
%12 = icmp eq i8 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %0, %13
%14 = phi i64 [ %17, %13 ], [ 0, %0 ]
%15 = phi i8 [ %20, %13 ], [ %11, %0 ]
%16 = phi i8* [ %19, %13 ], [ %3, %0 ]
%17 = add nuw i64 %14, 1
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %16, i8 signext %15)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %17
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %13
22: ; preds = %13, %0
%23 = call i32 @del_substr(i8* %3, i8* %4)
ret i32 %23
}