#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 /*<<< orphan*/ system(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ words_capture(int);
int main(void) {
  char ans[50];
  do {
    printf("(n)ew words, (l)ist words, (d)ictate words, (e)xit: ");
    scanf("%s", (char *)ans);
    switch (ans[0]) {
    case 'n':
      usleep(200000);
      words_capture(0);
      break;
    case 'l':
      system("ls words");
      break;
    case 'd':
      usleep(200000);
      words_capture(1);
      break;
    }
  } while (ans[0] != 'e');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x40(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x64,%eax
je     11d9 <main+0x89>
jmp    1190 <main+0x40>
mov    -0x44(%rbp),%eax
sub    $0x6c,%eax
je     11c8 <main+0x78>
jmp    11a1 <main+0x51>
mov    -0x44(%rbp),%eax
sub    $0x6e,%eax
jne    11ed <main+0x9d>
jmp    11b2 <main+0x62>
mov    $0x30d40,%edi
call   1070 <usleep@plt>
xor    %edi,%edi
call   1030 <words_capture@plt>
jmp    11ed <main+0x9d>
lea    0xe69(%rip),%rdi
call   1040 <system@plt>
jmp    11ed <main+0x9d>
mov    $0x30d40,%edi
call   1070 <usleep@plt>
mov    $0x1,%edi
call   1030 <words_capture@plt>
jmp    11f2 <main+0xa2>
movsbl -0x40(%rbp),%eax
cmp    $0x65,%eax
jne    115f <main+0xf>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe9e(%rip),%r14
lea    0xecc(%rip),%r15
mov    %rsp,%rbx
lea    0xec5(%rip),%r12
jmp    119c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x30d40,%edi
call   1070 <usleep@plt>
mov    $0x1,%edi
call   1030 <words_capture@plt>
movzbl (%rsp),%eax
cmp    $0x65,%al
je     11ea <main+0x9a>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movzbl (%rsp),%eax
movsbl %al,%ecx
cmp    $0x64,%ecx
je     1180 <main+0x30>
cmp    $0x6c,%ecx
je     11e0 <main+0x90>
cmp    $0x6e,%ecx
jne    1198 <main+0x48>
mov    $0x30d40,%edi
call   1070 <usleep@plt>
xor    %edi,%edi
jmp    118f <main+0x3f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1040 <system@plt>
jmp    1194 <main+0x44>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [53 x i8] c"(n)ew words, (l)ist words, (d)ictate words, (e)xit: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"ls words\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %19, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %18 [
i32 110, label %10
i32 108, label %13
i32 100, label %15
]
10: ; preds = %3
%11 = call i32 @usleep(i32 200000)
%12 = call i32 @words_capture(i32 0)
br label %18
13: ; preds = %3
%14 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %18
15: ; preds = %3
%16 = call i32 @usleep(i32 200000)
%17 = call i32 @words_capture(i32 1)
br label %18
18: ; preds = %3, %15, %13, %10
br label %19
19: ; preds = %18
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 101
br i1 %23, label %3, label %24
24: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"(n)ew words, (l)ist words, (d)ictate words, (e)xit: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"ls words\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %18, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
switch i32 %7, label %18 [
i32 110, label %8
i32 108, label %11
i32 100, label %13
]
8: ; preds = %3
%9 = call i32 @usleep(i32 200000)
%10 = call i32 @words_capture(i32 0)
br label %16
11: ; preds = %3
%12 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %16
13: ; preds = %3
%14 = call i32 @usleep(i32 200000)
%15 = call i32 @words_capture(i32 1)
br label %16
16: ; preds = %13, %11, %8
%17 = load i8, i8* %2
br label %18
18: ; preds = %16, %3
%19 = phi i8 [ %17, %16 ], [ %6, %3 ]
%20 = icmp eq i8 %19, 101
br i1 %20, label %21, label %3
21: ; preds = %18
ret i32 0
}