#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 getc(int /*<<< orphan*/);
scalar_t__ lexer_read_character_octal_brace(int, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int lexer_read_character_octal(int c) {
  int r = c - '0';
  if (lexer_read_character_octal_brace((c = getc(stdin)), &r)) {
    if (!lexer_read_character_octal_brace((c = getc(stdin)), &r))
      ungetc(c, stdin);
  } else
    ungetc(c, stdin);
  return r;
}


x86 assembly (clang, -O0):
<lexer_read_character_octal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %eax,%edi
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rsi
call   1030 <lexer_read_character_octal_brace@plt>
cmp    $0x0,%rax
je     11a6 <lexer_read_character_octal+0x76>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %eax,%edi
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rsi
call   1030 <lexer_read_character_octal_brace@plt>
cmp    $0x0,%rax
jne    11a1 <lexer_read_character_octal+0x71>
mov    -0x4(%rbp),%edi
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
jmp    11b7 <lexer_read_character_octal+0x87>
mov    -0x4(%rbp),%edi
mov    0x2e38(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_read_character_octal>:
push   %r14
push   %rbx
push   %rax
add    $0xffffffd0,%edi
mov    %edi,0x4(%rsp)
mov    0x2ea6(%rip),%r14
mov    (%r14),%edi
call   1050 <getc@plt>
mov    %eax,%ebx
lea    0x4(%rsp),%rsi
mov    %eax,%edi
call   1030 <lexer_read_character_octal_brace@plt>
mov    (%r14),%esi
test   %rax,%rax
je     117d <lexer_read_character_octal+0x4d>
mov    %esi,%edi
call   1050 <getc@plt>
mov    %eax,%ebx
lea    0x4(%rsp),%rsi
mov    %eax,%edi
call   1030 <lexer_read_character_octal_brace@plt>
test   %rax,%rax
jne    1184 <lexer_read_character_octal+0x54>
mov    (%r14),%esi
mov    %ebx,%edi
call   1040 <ungetc@plt>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @lexer_read_character_octal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 48
store i32 %5, i32* %3
%6 = load i32, i32* @stdin
%7 = call i32 @getc(i32 %6)
store i32 %7, i32* %2
%8 = call i64 @lexer_read_character_octal_brace(i32 %7, i32* %3)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = load i32, i32* @stdin
%12 = call i32 @getc(i32 %11)
store i32 %12, i32* %2
%13 = call i64 @lexer_read_character_octal_brace(i32 %12, i32* %3)
%14 = icmp ne i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = load i32, i32* %2
%17 = load i32, i32* @stdin
%18 = call i32 @ungetc(i32 %16, i32 %17)
br label %19
19: ; preds = %15, %10
br label %24
20: ; preds = %1
%21 = load i32, i32* %2
%22 = load i32, i32* @stdin
%23 = call i32 @ungetc(i32 %21, i32 %22)
br label %24
24: ; preds = %20, %19
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @lexer_read_character_octal(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = add nsw i32 %0, -48
store i32 %4, i32* %2
%5 = load i32, i32* @stdin
%6 = tail call i32 @getc(i32 %5)
%7 = call i64 @lexer_read_character_octal_brace(i32 %6, i32* %2)
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* @stdin
br i1 %8, label %17, label %10
10: ; preds = %1
%11 = call i32 @getc(i32 %9)
%12 = call i64 @lexer_read_character_octal_brace(i32 %11, i32* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i32, i32* @stdin
%16 = call i32 @ungetc(i32 %11, i32 %15)
br label %19
17: ; preds = %1
%18 = call i32 @ungetc(i32 %6, i32 %9)
br label %19
19: ; preds = %10, %14, %17
%20 = load i32, i32* %2
ret i32 %20
}