#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__ isspace(char);
int is_end_section(char *str) {
  char *ptr = str;
  while (isspace(*ptr))
    ptr++;
  if (*ptr != '}')
    return 0;
  ptr++;
  while (isspace(*ptr))
    ptr++;
  if (*ptr == '\n' || *ptr == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_end_section>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     114b <is_end_section+0x3b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <is_end_section+0x14>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
je     1167 <is_end_section+0x57>
movl   $0x0,-0x4(%rbp)
jmp    11cd <is_end_section+0xbd>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     119a <is_end_section+0x8a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1173 <is_end_section+0x63>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     11ba <is_end_section+0xaa>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11c6 <is_end_section+0xb6>
movl   $0x1,-0x4(%rbp)
jmp    11cd <is_end_section+0xbd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_end_section>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1120 <is_end_section+0x10>
xor    %eax,%eax
cmpb   $0x7d,-0x1(%rbx)
jne    1163 <is_end_section+0x53>
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <is_end_section+0x30>
mov    -0x1(%rbx),%al
cmp    $0xa,%al
sete   %cl
test   %al,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
pop    %rbx
ret

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

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