#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 */
struct type {
  int dummy;
};
struct triple {
  int dummy;
};
struct compile_state {
  int dummy;
};

/* Variables and functions */
struct type *arithmetic_result(struct compile_state *, struct triple *,
                               struct triple *);
int /*<<< orphan*/ eat(struct compile_state *, int);
int /*<<< orphan*/ integral(struct compile_state *, struct triple *);
int peek(struct compile_state *);
struct triple *read_expr(struct compile_state *, struct triple *);
struct triple *triple(struct compile_state *, int, struct type *,
                      struct triple *, struct triple *);
struct triple *xor_expr(struct compile_state *);
struct triple *or_expr(struct compile_state *state) {
  struct triple *def;
  def = xor_expr(state);
  while (peek(state) == 31) {
    struct triple *left, *right;
    struct type *result_type;
    left = read_expr(state, def);
    integral(state, left);
    eat(state, 31);
    right = read_expr(state, xor_expr(state));
    integral(state, right);
    result_type = arithmetic_result(state, left, right);
    def = triple(state, 15, result_type, left, right);
  }
  return def;
}


x86 assembly (clang, -O0):
<or_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <xor_expr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
cmp    $0x1f,%eax
jne    122d <or_expr+0xbd>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <read_expr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <integral@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1f,%esi
call   1040 <eat@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <xor_expr@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
call   1050 <read_expr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <integral@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <arithmetic_result@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0xf,%esi
call   1090 <triple@plt>
mov    %rax,-0x10(%rbp)
jmp    1189 <or_expr+0x19>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<or_expr>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1060 <xor_expr@plt>
nopl   (%rax)
mov    %rax,%r14
mov    %r15,%rdi
call   1030 <peek@plt>
cmp    $0x1f,%eax
jne    11fd <or_expr+0x8d>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <read_expr@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %rax,%rsi
call   1070 <integral@plt>
mov    %r15,%rdi
mov    $0x1f,%esi
call   1040 <eat@plt>
mov    %r15,%rdi
call   1060 <xor_expr@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <read_expr@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1070 <integral@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1080 <arithmetic_result@plt>
mov    %r15,%rdi
mov    $0xf,%esi
mov    %rax,%rdx
mov    %r14,%rcx
mov    %rbx,%r8
call   1090 <triple@plt>
jmp    1180 <or_expr+0x10>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.triple = type { i32 }
%struct.compile_state = type { i32 }
%struct.type = type { i32 }
define %struct.triple* @or_expr(%struct.compile_state* %0) {
%2 = alloca %struct.compile_state*
%3 = alloca %struct.triple*
%4 = alloca %struct.triple*
%5 = alloca %struct.triple*
%6 = alloca %struct.type*
store %struct.compile_state* %0, %struct.compile_state** %2
%7 = load %struct.compile_state*, %struct.compile_state** %2
%8 = call %struct.triple* @xor_expr(%struct.compile_state* %7)
store %struct.triple* %8, %struct.triple** %3
br label %9
9: ; preds = %13, %1
%10 = load %struct.compile_state*, %struct.compile_state** %2
%11 = call i32 @peek(%struct.compile_state* %10)
%12 = icmp eq i32 %11, 31
br i1 %12, label %13, label %38
13: ; preds = %9
%14 = load %struct.compile_state*, %struct.compile_state** %2
%15 = load %struct.triple*, %struct.triple** %3
%16 = call %struct.triple* @read_expr(%struct.compile_state* %14, %struct.triple* %15)
store %struct.triple* %16, %struct.triple** %4
%17 = load %struct.compile_state*, %struct.compile_state** %2
%18 = load %struct.triple*, %struct.triple** %4
%19 = call i32 @integral(%struct.compile_state* %17, %struct.triple* %18)
%20 = load %struct.compile_state*, %struct.compile_state** %2
%21 = call i32 @eat(%struct.compile_state* %20, i32 31)
%22 = load %struct.compile_state*, %struct.compile_state** %2
%23 = load %struct.compile_state*, %struct.compile_state** %2
%24 = call %struct.triple* @xor_expr(%struct.compile_state* %23)
%25 = call %struct.triple* @read_expr(%struct.compile_state* %22, %struct.triple* %24)
store %struct.triple* %25, %struct.triple** %5
%26 = load %struct.compile_state*, %struct.compile_state** %2
%27 = load %struct.triple*, %struct.triple** %5
%28 = call i32 @integral(%struct.compile_state* %26, %struct.triple* %27)
%29 = load %struct.compile_state*, %struct.compile_state** %2
%30 = load %struct.triple*, %struct.triple** %4
%31 = load %struct.triple*, %struct.triple** %5
%32 = call %struct.type* @arithmetic_result(%struct.compile_state* %29, %struct.triple* %30, %struct.triple* %31)
store %struct.type* %32, %struct.type** %6
%33 = load %struct.compile_state*, %struct.compile_state** %2
%34 = load %struct.type*, %struct.type** %6
%35 = load %struct.triple*, %struct.triple** %4
%36 = load %struct.triple*, %struct.triple** %5
%37 = call %struct.triple* @triple(%struct.compile_state* %33, i32 15, %struct.type* %34, %struct.triple* %35, %struct.triple* %36)
store %struct.triple* %37, %struct.triple** %3
br label %9
38: ; preds = %9
%39 = load %struct.triple*, %struct.triple** %3
ret %struct.triple* %39
}

LLVM IR (-O2):
%struct.triple = type { i32 }
%struct.compile_state = type { i32 }
%struct.type = type { i32 }
define %struct.triple* @or_expr(%struct.compile_state* %0) {
%2 = tail call %struct.triple* @xor_expr(%struct.compile_state* %0)
%3 = tail call i32 @peek(%struct.compile_state* %0)
%4 = icmp eq i32 %3, 31
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi %struct.triple* [ %14, %5 ], [ %2, %1 ]
%7 = tail call %struct.triple* @read_expr(%struct.compile_state* %0, %struct.triple* %6)
%8 = tail call i32 @integral(%struct.compile_state* %0, %struct.triple* %7)
%9 = tail call i32 @eat(%struct.compile_state* %0, i32 31)
%10 = tail call %struct.triple* @xor_expr(%struct.compile_state* %0)
%11 = tail call %struct.triple* @read_expr(%struct.compile_state* %0, %struct.triple* %10)
%12 = tail call i32 @integral(%struct.compile_state* %0, %struct.triple* %11)
%13 = tail call %struct.type* @arithmetic_result(%struct.compile_state* %0, %struct.triple* %7, %struct.triple* %11)
%14 = tail call %struct.triple* @triple(%struct.compile_state* %0, i32 15, %struct.type* %13, %struct.triple* %7, %struct.triple* %11)
%15 = tail call i32 @peek(%struct.compile_state* %0)
%16 = icmp eq i32 %15, 31
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi %struct.triple* [ %2, %1 ], [ %14, %5 ]
ret %struct.triple* %18
}