#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 cval;
int /*<<< orphan*/ error(char);
scalar_t__ mapch(char);
void getcc() {
  extern cval;
  auto c;
  cval = 0;
  if ((c = mapch('\'')) < 0)
    return;
  cval = c;
  if ((c = mapch('\'')) < 0)
    return;
  cval = cval * 512 + c;
  if (mapch('\'') >= 0)
    error('cc');
}


x86 assembly (clang, -O0):
<getcc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
movl   $0x0,(%rax)
mov    $0x27,%edi
call   1030 <mapch@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1150 <getcc+0x30>
jmp    11ad <getcc+0x8d>
mov    -0x4(%rbp),%ecx
mov    0x2e7e(%rip),%rax
mov    %ecx,(%rax)
mov    $0x27,%edi
call   1030 <mapch@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1177 <getcc+0x57>
jmp    11ad <getcc+0x8d>
mov    0x2e5a(%rip),%rax
mov    (%rax),%ecx
shl    $0x9,%ecx
add    -0x4(%rbp),%ecx
mov    0x2e4b(%rip),%rax
mov    %ecx,(%rax)
mov    $0x27,%edi
call   1030 <mapch@plt>
cmp    $0x0,%rax
jl     11ad <getcc+0x8d>
mov    $0x63,%edi
call   1040 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcc>:
push   %rbx
mov    0x2eb0(%rip),%rbx
movl   $0x0,(%rbx)
mov    $0x27,%edi
call   1030 <mapch@plt>
test   %eax,%eax
js     116f <getcc+0x4f>
mov    %eax,(%rbx)
mov    $0x27,%edi
call   1030 <mapch@plt>
test   %eax,%eax
js     116f <getcc+0x4f>
mov    (%rbx),%ecx
shl    $0x9,%ecx
add    %eax,%ecx
mov    %ecx,(%rbx)
mov    $0x27,%edi
call   1030 <mapch@plt>
test   %rax,%rax
js     116f <getcc+0x4f>
mov    $0x63,%edi
pop    %rbx
jmp    1040 <error@plt>
pop    %rbx
ret

LLVM IR (-O0):
@cval = global i32 0
define void @getcc() {
%1 = alloca i32
store i32 0, i32* @cval
%2 = call i64 @mapch(i8 signext 39)
%3 = trunc i64 %2 to i32
store i32 %3, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
br label %21
6: ; preds = %0
%7 = load i32, i32* %1
store i32 %7, i32* @cval
%8 = call i64 @mapch(i8 signext 39)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %1
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %6
br label %21
12: ; preds = %6
%13 = load i32, i32* @cval
%14 = mul nsw i32 %13, 512
%15 = load i32, i32* %1
%16 = add nsw i32 %14, %15
store i32 %16, i32* @cval
%17 = call i64 @mapch(i8 signext 39)
%18 = icmp sge i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 @error(i8 signext 99)
br label %21
21: ; preds = %5, %11, %19, %12
ret void
}

LLVM IR (-O2):
@cval = global i32 0
define void @getcc() {
store i32 0, i32* @cval
%1 = tail call i64 @mapch(i8 signext 39)
%2 = trunc i64 %1 to i32
%3 = icmp slt i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %0
store i32 %2, i32* @cval
%5 = tail call i64 @mapch(i8 signext 39)
%6 = trunc i64 %5 to i32
%7 = icmp slt i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = load i32, i32* @cval
%10 = shl nsw i32 %9, 9
%11 = add nsw i32 %10, %6
store i32 %11, i32* @cval
%12 = tail call i64 @mapch(i8 signext 39)
%13 = icmp sgt i64 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = tail call i32 @error(i8 signext 99)
br label %16
16: ; preds = %8, %14, %4, %0
ret void
}