#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 strlen(char *);
char F_FstC(char *str, char **n) {
  int i = 0;
  while (str[i] <= 32) {
    i++;
    if (i >= strlen(str))
      return 0;
  }
  *n = str + i;
  return str[i];
}


x86 assembly (clang, -O0):
<F_FstC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jg     116f <F_FstC+0x5f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jl     116a <F_FstC+0x5a>
movb   $0x0,-0x1(%rbp)
jmp    118f <F_FstC+0x7f>
jmp    1127 <F_FstC+0x17>
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rax
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<F_FstC>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   (%rax)
cmpb   $0x20,(%r15,%rbx,1)
jg     113e <F_FstC+0x2e>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1120 <F_FstC+0x10>
xor    %eax,%eax
jmp    1149 <F_FstC+0x39>
lea    (%r15,%rbx,1),%rax
mov    %rax,(%r14)
mov    (%r15,%rbx,1),%al
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define signext i8 @F_FstC(i8* %0, i8** nocapture writeonly %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i64 [ %9, %8 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp slt i8 %6, 33
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = add nuw nsw i64 %4, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %3, label %17
13: ; preds = %3
%14 = and i64 %4, 4294967295
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8* %15, i8** %1
%16 = load i8, i8* %15
br label %17
17: ; preds = %8, %13
%18 = phi i8 [ %16, %13 ], [ 0, %8 ]
ret i8 %18
}