#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 */
scalar_t__ gets(char *);
int /*<<< orphan*/ head(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ tail(char *);
int main() {
  char s[101], s2[] = "END";
  while (gets(s)) {
    head(s);
    tail(s);
    if (strcmp(s, s2) == 0)
      break;
    puts(s);
  }
  printf("END\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe88(%rip),%eax
mov    %eax,-0x74(%rbp)
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     11ca <main+0x6a>
lea    -0x70(%rbp),%rdi
call   1080 <head@plt>
lea    -0x70(%rbp),%rdi
call   1070 <tail@plt>
lea    -0x70(%rbp),%rdi
lea    -0x74(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11bc <main+0x5c>
jmp    11ca <main+0x6a>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
jmp    117b <main+0x1b>
lea    0xe33(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
movl   $0x444e45,0xc(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11b5 <main+0x65>
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <head@plt>
mov    %rbx,%rdi
call   1060 <tail@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b5 <main+0x65>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
test   %rax,%rax
jne    1180 <main+0x30>
lea    0xe44(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s2 = [4 x i8] c"END\00"
@.str = [5 x i8] c"END\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x i8]
%3 = alloca [4 x i8]
store i32 0, i32* %1
%4 = bitcast [4 x i8]* %3 to i8*
br label %5
5: ; preds = %19, %0
%6 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%7 = call i64 @gets(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%11 = call i32 @head(i8* %10)
%12 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%13 = call i32 @tail(i8* %12)
%14 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%16 = call i64 @strcmp(i8* %14, i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %9
br label %22
19: ; preds = %9
%20 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%21 = call i32 @puts(i8* %20)
br label %5
22: ; preds = %18, %5
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [4 x i8] c"END\00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 4476485, i32* %2
%5 = call i64 @gets(i8* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %12
%8 = call i32 @head(i8* %3)
%9 = call i32 @tail(i8* %3)
%10 = call i64 @strcmp(i8* %3, i8* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = call i32 @puts(i8* %3)
%14 = call i64 @gets(i8* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %12, %7, %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}