#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__ putf8_isutf(char);
void putf8_inc(char *s, int *i) {
  (void)(putf8_isutf(s[++(*i)]) || putf8_isutf(s[++(*i)]) ||
         putf8_isutf(s[++(*i)]) || ++(*i));
}


x86 assembly (clang, -O0):
<putf8_inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdx
mov    (%rdx),%ecx
add    $0x1,%ecx
mov    %ecx,(%rdx)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putf8_isutf@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11bb <putf8_inc+0xab>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdx
mov    (%rdx),%ecx
add    $0x1,%ecx
mov    %ecx,(%rdx)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putf8_isutf@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11bb <putf8_inc+0xab>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdx
mov    (%rdx),%ecx
add    $0x1,%ecx
mov    %ecx,(%rdx)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putf8_isutf@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11bb <putf8_inc+0xab>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %eax,(%rcx)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putf8_inc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movslq (%rsi),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rsi)
movsbl 0x1(%rdi,%rax,1),%edi
call   1030 <putf8_isutf@plt>
test   %rax,%rax
jne    1167 <putf8_inc+0x57>
movslq (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rbx)
movsbl 0x1(%r14,%rax,1),%edi
call   1030 <putf8_isutf@plt>
test   %rax,%rax
jne    1167 <putf8_inc+0x57>
movslq (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rbx)
movsbl 0x1(%r14,%rax,1),%edi
call   1030 <putf8_isutf@plt>
test   %rax,%rax
jne    1167 <putf8_inc+0x57>
addl   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @putf8_inc(i8* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 1
store i32 %4, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call i64 @putf8_isutf(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %2
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = tail call i64 @putf8_isutf(i8 signext %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %10
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = tail call i64 @putf8_isutf(i8 signext %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %18
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
store i32 %28, i32* %1
br label %29
29: ; preds = %26, %18, %10, %2
ret void
}