#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*/ abort();
int r(const char *f) {
  static char c[2] = "b";
  static int cnt = 0;
  if (*f != *c || f[1] != c[1] || cnt > 3)
    abort();
  c[0]++;
  cnt++;
  return 1;
}


x86 assembly (clang, -O0):
<r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl 0x2efe(%rip),%ecx
cmp    %ecx,%eax
jne    1156 <r+0x46>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
movsbl 0x2ee8(%rip),%ecx
cmp    %ecx,%eax
jne    1156 <r+0x46>
cmpl   $0x3,0x2ee0(%rip)
jle    115d <r+0x4d>
mov    $0x0,%al
call   1030 <abort@plt>
mov    0x2ec5(%rip),%al
add    $0x1,%al
mov    %al,0x2ebd(%rip)
mov    0x2ebf(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eb6(%rip)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r>:
push   %rax
mov    (%rdi),%al
cmp    0x2f0f(%rip),%al
jne    1144 <r+0x34>
cmpb   $0x0,0x1(%rdi)
jne    1144 <r+0x34>
mov    0x2f09(%rip),%ecx
cmp    $0x4,%ecx
jge    1144 <r+0x34>
add    $0x1,%al
mov    %al,0x2ef4(%rip)
add    $0x1,%ecx
mov    %ecx,0x2ef3(%rip)
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@r.c = internal global [2 x i8] c"b\00"
@r.cnt = internal global i32 0
define i32 @r(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @r.c, i64 0, i64 0)
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %20, label %9
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @r.c, i64 0, i64 1)
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %13, %15
br i1 %16, label %20, label %17
17: ; preds = %9
%18 = load i32, i32* @r.cnt
%19 = icmp sgt i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17, %9, %1
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %17
%23 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @r.c, i64 0, i64 0)
%24 = add i8 %23, 1
store i8 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @r.c, i64 0, i64 0)
%25 = load i32, i32* @r.cnt
%26 = add nsw i32 %25, 1
store i32 %26, i32* @r.cnt
ret i32 1
}

LLVM IR (-O2):
@r.c.0 = internal unnamed_addr global i8 98
@r.cnt = internal unnamed_addr global i32 0
define i32 @r(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = load i8, i8* @r.c.0
%4 = icmp eq i8 %2, %3
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
%9 = load i32, i32* @r.cnt
%10 = icmp sgt i32 %9, 3
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %12, label %14
12: ; preds = %5, %1
%13 = tail call i32 (...) @abort()
unreachable
14: ; preds = %5
%15 = add i8 %2, 1
store i8 %15, i8* @r.c.0
%16 = add nsw i32 %9, 1
store i32 %16, i32* @r.cnt
ret i32 1
}