#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 *);
int main(void) {
  char our_string[21];
  printf("You want to say:");
  scanf("%s", our_string);
  int length = 0;
  while (our_string[length] != '\0') {
    length += 1;
  }
  if (length > 6) {
    for (int index = 0; index < 4; index++) {
      printf("%c", our_string[index]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1174 <main+0x54>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1154 <main+0x34>
cmpl   $0x6,-0x24(%rbp)
jle    11c2 <main+0xa2>
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    11b4 <main+0x94>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1185 <main+0x65>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1160 <main+0x30>
cmp    $0x7,%eax
jb     11a2 <main+0x72>
movsbl (%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x1(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x2(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0x3(%rsp),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"You want to say:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
store i32 0, i32* %3
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %8
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 6
br i1 %20, label %21, label %37
21: ; preds = %18
store i32 0, i32* %4
br label %22
22: ; preds = %32, %21
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 4
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %25
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %22
35: ; preds = %22
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"You want to say:\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ %10, %5 ], [ 0, %0 ]
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = add nuw i64 %6, 1
br i1 %9, label %11, label %5
11: ; preds = %5
%12 = trunc i64 %6 to i32
%13 = icmp ugt i32 %12, 6
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = call i32 @putchar(i32 %16)
%18 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 @putchar(i32 %20)
%22 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 @putchar(i32 %24)
%26 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 3
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = call i32 @putchar(i32 %28)
%30 = call i32 @putchar(i32 10)
br label %31
31: ; preds = %14, %11
ret i32 0
}