#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*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
char *readline_last(char *);
scalar_t__ strcmp(char *, char *);
void test_readline_last_without_10() {
  printf("\n================\n");
  char *buf = ""
              "c++\n"
              "lua\n"
              "javascript";
  char *last = readline_last(buf);
  printf("last: %s\n", last);
  assert(strcmp("javascript", last) == 0);
  printf("\t OK\n");
}


x86 assembly (clang, -O0):
<test_readline_last_without_10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <readline_last@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_readline_last_without_10>:
push   %rbx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1040 <readline_last@plt>
mov    %rax,%rbx
lea    0xea0(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xe8e(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"\0A================\0A\00"
@.str.1 = [19 x i8] c"c++\0Alua\0Ajavascript\00"
@.str.2 = [10 x i8] c"last: %s\0A\00"
@.str.3 = [11 x i8] c"javascript\00"
@.str.4 = [6 x i8] c"\09 OK\0A\00"
define void @test_readline_last_without_10() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8** %1
%4 = load i8*, i8** %1
%5 = call i8* @readline_last(i8* %4)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
%9 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"c++\0Alua\0Ajavascript\00"
@.str.2 = [10 x i8] c"last: %s\0A\00"
@.str.3 = [11 x i8] c"javascript\00"
@str = [18 x i8] c"\0A================\00"
@str.5 = [5 x i8] c"\09 OK\00"
define void @test_readline_last_without_10() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i8* @readline_last(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
ret void
}