#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ getc(int /*<<< orphan*/ *);
int tolower(int /*<<< orphan*/);
void tag_section(char *buffer, FILE *stream) {
  int c, index = 0;
  while (EOF != (c = tolower(getc(stream))) && '>' != c)
    buffer[index++] = c;
  buffer[index++] = '\0';
}


x86 assembly (clang, -O0):
<tag_section>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,%edi
call   1030 <tolower@plt>
mov    -0x20(%rbp),%ecx
mov    %eax,%edx
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x19(%rbp)
je     1176 <tag_section+0x56>
mov    $0x3e,%eax
cmp    -0x14(%rbp),%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1186 <tag_section+0x66>
jmp    11a5 <tag_section+0x85>
mov    -0x14(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1137 <tag_section+0x17>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_section>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
mov    0x2eb3(%rip),%r15
mov    (%r15),%ebx
mov    %rsi,%rdi
call   1040 <getc@plt>
mov    %eax,%edi
call   1030 <tolower@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
je     1185 <tag_section+0x65>
cmp    $0x3e,%eax
je     1185 <tag_section+0x65>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    (%r15),%ebp
mov    %r12,%rdi
call   1040 <getc@plt>
mov    %eax,%edi
call   1030 <tolower@plt>
cmp    %eax,%ebp
je     1183 <tag_section+0x63>
cmp    $0x3e,%eax
jne    1160 <tag_section+0x40>
mov    %ebx,%ecx
movb   $0x0,(%r14,%rcx,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @tag_section(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %6
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* @EOF
%9 = load i32*, i32** %4
%10 = call i32 @getc(i32* %9)
%11 = call i32 @tolower(i32 %10)
store i32 %11, i32* %5
%12 = icmp ne i32 %8, %11
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i32, i32* %5
%15 = icmp ne i32 62, %14
br label %16
16: ; preds = %13, %7
%17 = phi i1 [ false, %7 ], [ %15, %13 ]
br i1 %17, label %18, label %26
18: ; preds = %16
%19 = load i32, i32* %5
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %3
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
store i8 %20, i8* %25
br label %7
26: ; preds = %16
%27 = load i8*, i8** %3
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
store i8 0, i8* %31
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @tag_section(i8* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* @EOF
%4 = tail call i32 @getc(i32* %1)
%5 = tail call i32 @tolower(i32 %4)
%6 = icmp ne i32 %3, %5
%7 = icmp ne i32 %5, 62
%8 = and i1 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %2, %9
%10 = phi i64 [ %13, %9 ], [ 0, %2 ]
%11 = phi i32 [ %17, %9 ], [ %5, %2 ]
%12 = trunc i32 %11 to i8
%13 = add nuw i64 %10, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 %12, i8* %14
%15 = load i32, i32* @EOF
%16 = tail call i32 @getc(i32* %1)
%17 = tail call i32 @tolower(i32 %16)
%18 = icmp ne i32 %15, %17
%19 = icmp ne i32 %17, 62
%20 = and i1 %18, %19
br i1 %20, label %9, label %21
21: ; preds = %9
%22 = and i64 %13, 4294967295
br label %23
23: ; preds = %21, %2
%24 = phi i64 [ 0, %2 ], [ %22, %21 ]
%25 = getelementptr inbounds i8, i8* %0, i64 %24
store i8 0, i8* %25
ret void
}