#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 delete_word(char *, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
void main() {
  char a[81];
  int b, len;
  printf("enter a string A (< 80 chars): ");
  fgets(a, 81, stdin);
  printf("enter the position: ");
  scanf("%d", &b);
  printf("original string A: ");
  puts(a);
  if ((len = delete_word(a, b)) != -1) {
    printf("\nmodified string A: ");
    puts(a);
    printf("\nlength of the modified A: %d", len);
  } else
    printf("\nPosition out of range");
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
mov    $0x51,%esi
call   1050 <fgets@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x64(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1060 <delete_word@plt>
mov    %eax,-0x68(%rbp)
cmp    $0xffffffff,%eax
je     11f7 <main+0xa7>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x68(%rbp),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1205 <main+0xb5>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x51,%esi
call   1050 <fgets@plt>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <delete_word@plt>
cmp    $0xffffffff,%eax
je     11f0 <main+0xa0>
mov    %eax,%ebx
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11fe <main+0xae>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"enter a string A (< 80 chars): \00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"enter the position: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [20 x i8] c"original string A: \00"
@.str.4 = [21 x i8] c"\0Amodified string A: \00"
@.str.5 = [30 x i8] c"\0Alength of the modified A: %d\00"
@.str.6 = [23 x i8] c"\0APosition out of range\00"
define void @main() {
%1 = alloca [81 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 81, i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%11 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
%13 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%14 = load i32, i32* %2
%15 = call i32 @delete_word(i8* %13, i32 %14)
store i32 %15, i32* %3
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %23
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%19 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %25
25: ; preds = %23, %17
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"enter a string A (< 80 chars): \00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"enter the position: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [20 x i8] c"original string A: \00"
@.str.4 = [21 x i8] c"\0Amodified string A: \00"
@.str.5 = [30 x i8] c"\0Alength of the modified A: %d\00"
@.str.6 = [23 x i8] c"\0APosition out of range\00"
define void @main() {
%1 = alloca [81 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 81, i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @puts(i8* %3)
%12 = load i32, i32* %2
%13 = call i32 @delete_word(i8* %3, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %19, label %15
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @puts(i8* %3)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %13)
br label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
ret void
}