#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*/ getLineString(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void testTruncate() {
  printf("testTruncate\n");
  char buffer[20];
  getLineString(buffer, "123456789012345");
  assert(!strcmp(buffer, "123456789012"));
  printf(".");
  printf("\ntestTruncate successful.\n");
}


x86 assembly (clang, -O0):
<testTruncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1060 <getLineString@plt>
lea    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTruncate>:
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%rsi
mov    %rsp,%rdi
call   1060 <getLineString@plt>
movabs $0x3837363534333231,%rax
36 37 38
xor    (%rsp),%rax
movabs $0x32313039383736,%rcx
xor    0x5(%rsp),%rcx
xor    %edi,%edi
or     %rax,%rcx
sete   %dil
call   1050 <assert@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"testTruncate\0A\00"
@.str.1 = [16 x i8] c"123456789012345\00"
@.str.2 = [13 x i8] c"123456789012\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [27 x i8] c"\0AtestTruncate successful.\0A\00"
define void @testTruncate() {
%1 = alloca [20 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @getLineString(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i32 @strcmp(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"123456789012345\00"
@.str.2 = [13 x i8] c"123456789012\00"
@str = [13 x i8] c"testTruncate\00"
@str.5 = [26 x i8] c"\0AtestTruncate successful.\00"
define void @testTruncate() {
%1 = alloca [20 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @getLineString(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @bcmp(i8* dereferenceable(13) %3, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 13)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @putchar(i32 46)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
ret void
}