#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*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strlen(char *);
scalar_t__ strspn(char *, char *);
void screen_draw(char *s, int len, int row, int col, char *a) {
  char *b = malloc(len + 2);
  memcpy(b, s, len);
  b[len] = '\0';
  if (strspn(b, " ") != strlen(b))
    printf("%s\n", b);
  free(b);
}


x86 assembly (clang, -O0):
<screen_draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0xc(%rbp),%edi
add    $0x2,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1070 <memcpy@plt>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1060 <strspn@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     11e1 <screen_draw+0x81>
mov    -0x28(%rbp),%rsi
lea    0xe26(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<screen_draw>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x2(%r14),%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1070 <memcpy@plt>
movslq %r14d,%rax
movb   $0x0,(%rbx,%rax,1)
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strspn@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%r14
je     11ba <screen_draw+0x5a>
lea    0xe50(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @screen_draw(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load i32, i32* %7
%13 = add nsw i32 %12, 2
%14 = call i8* @malloc(i32 %13)
store i8* %14, i8** %11
%15 = load i8*, i8** %11
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = call i32 @memcpy(i8* %15, i8* %16, i32 %17)
%19 = load i8*, i8** %11
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %11
%24 = call i64 @strspn(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = load i8*, i8** %11
%26 = call i64 @strlen(i8* %25)
%27 = icmp ne i64 %24, %26
br i1 %27, label %28, label %31
28: ; preds = %5
%29 = load i8*, i8** %11
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %5
%32 = load i8*, i8** %11
%33 = call i32 @free(i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @screen_draw(i8* %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4) {
%6 = add nsw i32 %1, 2
%7 = tail call i8* @malloc(i32 %6)
%8 = tail call i32 @memcpy(i8* %7, i8* %0, i32 %1)
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8 0, i8* %10
%11 = tail call i64 @strspn(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = tail call i64 @strlen(i8* dereferenceable(1) %7)
%13 = icmp eq i64 %11, %12
br i1 %13, label %16, label %14
14: ; preds = %5
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %16
16: ; preds = %14, %5
%17 = tail call i32 @free(i8* %7)
ret void
}