#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 tnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rcexpr(struct tnode *);
void cbranch(struct tnode *t, int lab, int val) {
  rcexpr(t);
  if (val == 0)
    printf("\ttest\t%%eax,%%eax\n");
  else
    printf("\tcmp\t%%eax,$%d\n", val);
  printf("\tje\tL%d\n", lab);
}


x86 assembly (clang, -O0):
<cbranch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rcexpr@plt>
cmpl   $0x0,-0x10(%rbp)
jne    1158 <cbranch+0x38>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1169 <cbranch+0x49>
mov    -0x10(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbranch>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%ebx
call   1040 <rcexpr@plt>
test   %ebp,%ebp
je     1142 <cbranch+0x22>
lea    0xedc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1150 <cbranch+0x30>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.tnode = type { i32 }
@.str = [19 x i8] c"\09test\09%%eax,%%eax\0A\00"
@.str.1 = [16 x i8] c"\09cmp\09%%eax,$%d\0A\00"
@.str.2 = [9 x i8] c"\09je\09L%d\0A\00"
define void @cbranch(%struct.tnode* %0, i32 %1, i32 %2) {
%4 = alloca %struct.tnode*
%5 = alloca i32
%6 = alloca i32
store %struct.tnode* %0, %struct.tnode** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.tnode*, %struct.tnode** %4
%8 = call i32 @rcexpr(%struct.tnode* %7)
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %16
13: ; preds = %3
%14 = load i32, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %11
%17 = load i32, i32* %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %17)
ret void
}

LLVM IR (-O2):
%struct.tnode = type { i32 }
@.str = [19 x i8] c"\09test\09%%eax,%%eax\0A\00"
@.str.1 = [16 x i8] c"\09cmp\09%%eax,$%d\0A\00"
@.str.2 = [9 x i8] c"\09je\09L%d\0A\00"
define void @cbranch(%struct.tnode* %0, i32 %1, i32 %2) {
%4 = tail call i32 @rcexpr(%struct.tnode* %0)
%5 = icmp eq i32 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %2)
br label %10
10: ; preds = %8, %6
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret void
}