#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*/ sprintf(char *, char *, int);
int tl_Getchar();
int /*<<< orphan*/ tl_UnGetchar();
int /*<<< orphan*/ tl_yyerror(char *);
int tl_follow(int tok, int ifyes, int ifno) {
  int c;
  char buf[32];
  extern int tl_yychar;
  if ((c = tl_Getchar()) == tok)
    return ifyes;
  tl_UnGetchar();
  tl_yychar = c;
  sprintf(buf, "expected '%c'", tok);
  tl_yyerror(buf);
  return ifno;
}


x86 assembly (clang, -O0):
<tl_follow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <tl_Getchar@plt>
mov    %eax,-0x14(%rbp)
cmp    -0x8(%rbp),%eax
jne    116f <tl_follow+0x2f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a4 <tl_follow+0x64>
mov    $0x0,%al
call   1030 <tl_UnGetchar@plt>
mov    -0x14(%rbp),%ecx
mov    0x2e60(%rip),%rax
mov    %ecx,(%rax)
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe70(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1060 <tl_yyerror@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tl_follow>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%r15d
xor    %eax,%eax
call   1040 <tl_Getchar@plt>
cmp    %r15d,%eax
je     1190 <tl_follow+0x50>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <tl_UnGetchar@plt>
mov    0x2e72(%rip),%rax
mov    %ebp,(%rax)
lea    0xe89(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15d,%edx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <tl_yyerror@plt>
mov    %r14d,%ebx
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@tl_yychar = external global i32
@.str = [14 x i8] c"expected '%c'\00"
define i32 @tl_follow(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [32 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = call i32 (...) @tl_Getchar()
store i32 %10, i32* %8
%11 = load i32, i32* %5
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i32, i32* %6
store i32 %14, i32* %4
br label %24
15: ; preds = %3
%16 = call i32 (...) @tl_UnGetchar()
%17 = load i32, i32* %8
store i32 %17, i32* @tl_yychar
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%19 = load i32, i32* %5
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%22 = call i32 @tl_yyerror(i8* %21)
%23 = load i32, i32* %7
store i32 %23, i32* %4
br label %24
24: ; preds = %15, %13
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@tl_yychar = external global i32
@.str = [14 x i8] c"expected '%c'\00"
define i32 @tl_follow(i32 %0, i32 %1, i32 %2) {
%4 = alloca [32 x i8]
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%6 = tail call i32 (...) @tl_Getchar()
%7 = icmp eq i32 %6, %0
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = tail call i32 (...) @tl_UnGetchar()
store i32 %6, i32* @tl_yychar
%10 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
%11 = call i32 @tl_yyerror(i8* %5)
br label %12
12: ; preds = %3, %8
%13 = phi i32 [ %2, %8 ], [ %1, %3 ]
ret i32 %13
}