#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(void) {
  char words[14];
  puts("Enter a string, please.");
  fgets(words, 14, stdin);
  puts("Your string twice (puts(), then fputs()):");
  puts(words);
  fputs(words, stdout);
  puts("Enter another string, please.");
  fgets(words, 14, stdin);
  puts("Your string twice (puts(), then fputs()):");
  puts(words);
  fputs(words, stdout);
  puts("Done.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    -0x12(%rbp),%rdi
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
mov    $0xe,%esi
call   1050 <fgets@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    -0x12(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x12(%rbp),%rdi
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
lea    -0x12(%rbp),%rdi
mov    0x2e48(%rip),%rax
mov    (%rax),%edx
mov    $0xe,%esi
call   1050 <fgets@plt>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
lea    -0x12(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x12(%rbp),%rdi
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e9a(%rip),%r15
mov    (%r15),%edx
lea    0xa(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xe,%esi
call   1050 <fgets@plt>
lea    0xeae(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x2e57(%rip),%r12
mov    (%r12),%esi
mov    %rbx,%rdi
call   1040 <fputs@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0xe,%esi
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1040 <fputs@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter a string, please.\00"
@stdin = global i32 0
@.str.1 = [42 x i8] c"Your string twice (puts(), then fputs()):\00"
@stdout = global i32 0
@.str.2 = [30 x i8] c"Enter another string, please.\00"
@.str.3 = [6 x i8] c"Done.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 14, i32 %5)
%7 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%9 = call i32 @puts(i8* %8)
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* @stdout
%12 = call i32 @fputs(i8* %10, i32 %11)
%13 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 14, i32 %15)
%17 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%19 = call i32 @puts(i8* %18)
%20 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%21 = load i32, i32* @stdout
%22 = call i32 @fputs(i8* %20, i32 %21)
%23 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter a string, please.\00"
@stdin = global i32 0
@.str.1 = [42 x i8] c"Your string twice (puts(), then fputs()):\00"
@stdout = global i32 0
@.str.2 = [30 x i8] c"Enter another string, please.\00"
@.str.3 = [6 x i8] c"Done.\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 14, i32 %4)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* %2)
%8 = load i32, i32* @stdout
%9 = call i32 @fputs(i8* %2, i32 %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %2, i32 14, i32 %11)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @puts(i8* %2)
%15 = load i32, i32* @stdout
%16 = call i32 @fputs(i8* %2, i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}