#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*/ scanf(char *, char *);
scalar_t__ string_reduce(char *);
int main() {
  printf("\n Enter Ctrl+C to exit \n");
  while (1) {
    char string[100 + 1] = {0};
    printf("\nEnter String ");
    scanf("%s", string);
    printf("\nInput %s\n", string);
    string_reduce(string);
    if (string_reduce(string)) {
      printf("\n %s ", string);
    } else
      printf("\n Empty String");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1050 <memset@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <string_reduce@plt>
lea    -0x70(%rbp),%rdi
call   1040 <string_reduce@plt>
cmp    $0x0,%rax
je     11d0 <main+0x90>
lea    -0x70(%rbp),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <main+0x9e>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%r14
lea    0xea7(%rip),%r15
mov    %rsp,%rbx
lea    0xea0(%rip),%r12
lea    0xeaa(%rip),%r13
lea    0xe9d(%rip),%rbp
jmp    119d <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x5d(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <string_reduce@plt>
mov    %rbx,%rdi
call   1050 <string_reduce@plt>
test   %rax,%rax
jne    1190 <main+0x50>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    119d <main+0x5d>

LLVM IR (-O0):
@.str = [25 x i8] c"\0A Enter Ctrl+C to exit \0A\00"
@.str.1 = [15 x i8] c"\0AEnter String \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [11 x i8] c"\0AInput %s\0A\00"
@.str.4 = [6 x i8] c"\0A %s \00"
@.str.5 = [15 x i8] c"\0A Empty String\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %21
%5 = bitcast [101 x i8]* %2 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%12 = call i64 @string_reduce(i8* %11)
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%14 = call i64 @string_reduce(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %17)
br label %21
19: ; preds = %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
br label %4
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"\0AEnter String \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [11 x i8] c"\0AInput %s\0A\00"
@.str.4 = [6 x i8] c"\0A %s \00"
@.str.5 = [15 x i8] c"\0A Empty String\00"
@str = [24 x i8] c"\0A Enter Ctrl+C to exit \00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
br label %4
4: ; preds = %0, %15
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%8 = call i64 @string_reduce(i8* %3)
%9 = call i64 @string_reduce(i8* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %4
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %3)
br label %15
13: ; preds = %4
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
br label %4
}