#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*/ is_measure_separator(char);
int /*<<< orphan*/ isspace(char);
int strlen(char *);
int is_junk(char *s) {
  int i, len;
  len = strlen(s);
  for (i = 0; i < len; i++)
    if (!isspace(s[i]) && !is_measure_separator(s[i]) && s[i] != '\n')
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_junk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11c3 <is_junk+0x93>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    11b0 <is_junk+0x80>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <is_measure_separator@plt>
cmp    $0x0,%eax
jne    11b0 <is_junk+0x80>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     11b0 <is_junk+0x80>
movl   $0x0,-0x4(%rbp)
jmp    11ca <is_junk+0x9a>
jmp    11b5 <is_junk+0x85>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114f <is_junk+0x1f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_junk>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    117c <is_junk+0x4c>
mov    %eax,%r15d
xor    %ebp,%ebp
jmp    1159 <is_junk+0x29>
add    $0x1,%rbp
cmp    %rbp,%r15
je     117c <is_junk+0x4c>
movsbl (%rbx,%rbp,1),%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1150 <is_junk+0x20>
movsbl (%rbx,%rbp,1),%edi
call   1050 <is_measure_separator@plt>
test   %eax,%eax
jne    1150 <is_junk+0x20>
cmpb   $0xa,(%rbx,%rbp,1)
je     1150 <is_junk+0x20>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_junk(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
store i32 0, i32* %4
br label %8
8: ; preds = %38, %1
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %41
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = call i32 @isspace(i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %37, label %20
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = call i32 @is_measure_separator(i8 signext %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %37, label %28
28: ; preds = %20
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 10
br i1 %35, label %36, label %37
36: ; preds = %28
store i32 0, i32* %2
br label %42
37: ; preds = %28, %20, %12
br label %38
38: ; preds = %37
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %8
41: ; preds = %8
store i32 1, i32* %2
br label %42
42: ; preds = %41, %36
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
define i32 @is_junk(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %22
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %19
%7 = phi i64 [ 0, %4 ], [ %20, %19 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @isspace(i8 signext %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %6
%13 = load i8, i8* %8
%14 = tail call i32 @is_measure_separator(i8 signext %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i8, i8* %8
%18 = icmp eq i8 %17, 10
br i1 %18, label %19, label %22
19: ; preds = %6, %12, %16
%20 = add nuw nsw i64 %7, 1
%21 = icmp eq i64 %20, %5
br i1 %21, label %22, label %6
22: ; preds = %16, %19, %1
%23 = phi i32 [ 1, %1 ], [ 1, %19 ], [ 0, %16 ]
ret i32 %23
}