struct triple *land_expr(struct compile_state *state) {
  struct triple *def;
  def = or_expr(state);
  while (peek(state) == 30) {
    struct triple *left, *right;
    left = read_expr(state, def);
    bool(state, left);
    eat(state, 30);
    right = read_expr(state, or_expr(state));
    bool(state, right);
    def = mkland_expr(state, ltrue_expr(state, left), ltrue_expr(state, right));
  }
  return def;
}


x86 assembly (clang, -O0):
<land_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1080 <or_expr@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <peek@plt>
cmp    $0x1e,%eax
jne    124e <land_expr+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <read_expr@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <bool@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1e,%esi
mov    $0x0,%al
call   1050 <eat@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1080 <or_expr@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
mov    $0x0,%al
call   1060 <read_expr@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <bool@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <ltrue_expr@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <ltrue_expr@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
mov    $0x0,%al
call   1090 <mkland_expr@plt>
cltq
mov    %rax,-0x10(%rbp)
jmp    118d <land_expr+0x1d>
mov    -0x10(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<land_expr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1080 <or_expr@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %eax,%r14
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x1e,%eax
jne    1227 <land_expr+0xb7>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <read_expr@plt>
movslq %eax,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <bool@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
xor    %eax,%eax
call   1050 <eat@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <or_expr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <read_expr@plt>
movslq %eax,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <bool@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <ltrue_expr@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <ltrue_expr@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <mkland_expr@plt>
jmp    1190 <land_expr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.triple = type opaque
%struct.compile_state = type opaque
define %struct.triple* @land_expr(%struct.compile_state* %0) {
%2 = tail call i32 (%struct.compile_state*, ...) bitcast (i32 (...)* @or_expr to i32 (%struct.compile_state*, ...)*)(%struct.compile_state* %0)
%3 = sext i32 %2 to i64
%4 = tail call i32 (%struct.compile_state*, ...) bitcast (i32 (...)* @peek to i32 (%struct.compile_state*, ...)*)(%struct.compile_state* %0)
%5 = icmp eq i32 %4, 30
br i1 %5, label %6, label %25
6: ; preds = %1, %6
%7 = phi i64 [ %22, %6 ], [ %3, %1 ]
%8 = inttoptr i64 %7 to %struct.triple*
%9 = tail call i32 (%struct.compile_state*, %struct.triple*, ...) bitcast (i32 (...)* @read_expr to i32 (%struct.compile_state*, %struct.triple*, ...)*)(%struct.compile_state* %0, %struct.triple* %8)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to %struct.triple*
%12 = tail call i32 (%struct.compile_state*, %struct.triple*, ...) bitcast (i32 (...)* @bool to i32 (%struct.compile_state*, %struct.triple*, ...)*)(%struct.compile_state* %0, %struct.triple* %11)
%13 = tail call i32 (%struct.compile_state*, i32, ...) bitcast (i32 (...)* @eat to i32 (%struct.compile_state*, i32, ...)*)(%struct.compile_state* %0, i32 30)
%14 = tail call i32 (%struct.compile_state*, ...) bitcast (i32 (...)* @or_expr to i32 (%struct.compile_state*, ...)*)(%struct.compile_state* %0)
%15 = tail call i32 (%struct.compile_state*, i32, ...) bitcast (i32 (...)* @read_expr to i32 (%struct.compile_state*, i32, ...)*)(%struct.compile_state* %0, i32 %14)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to %struct.triple*
%18 = tail call i32 (%struct.compile_state*, %struct.triple*, ...) bitcast (i32 (...)* @bool to i32 (%struct.compile_state*, %struct.triple*, ...)*)(%struct.compile_state* %0, %struct.triple* %17)
%19 = tail call i32 (%struct.compile_state*, %struct.triple*, ...) bitcast (i32 (...)* @ltrue_expr to i32 (%struct.compile_state*, %struct.triple*, ...)*)(%struct.compile_state* %0, %struct.triple* %11)
%20 = tail call i32 (%struct.compile_state*, %struct.triple*, ...) bitcast (i32 (...)* @ltrue_expr to i32 (%struct.compile_state*, %struct.triple*, ...)*)(%struct.compile_state* %0, %struct.triple* %17)
%21 = tail call i32 (%struct.compile_state*, i32, i32, ...) bitcast (i32 (...)* @mkland_expr to i32 (%struct.compile_state*, i32, i32, ...)*)(%struct.compile_state* %0, i32 %19, i32 %20)
%22 = sext i32 %21 to i64
%23 = tail call i32 (%struct.compile_state*, ...) bitcast (i32 (...)* @peek to i32 (%struct.compile_state*, ...)*)(%struct.compile_state* %0)
%24 = icmp eq i32 %23, 30
br i1 %24, label %6, label %25
25: ; preds = %6, %1
%26 = phi i64 [ %3, %1 ], [ %22, %6 ]
%27 = inttoptr i64 %26 to %struct.triple*
ret %struct.triple* %27
}