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

/* Variables and functions */
scalar_t__ is_const(struct triple *);
scalar_t__ triple_is_ubranch(struct compile_state *, struct triple *);
int is_scc_const(struct compile_state *state, struct triple *ins) {
  return ins && (triple_is_ubranch(state, ins) || is_const(ins));
}


x86 assembly (clang, -O0):
<is_scc_const>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1178 <is_scc_const+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <triple_is_ubranch@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    1172 <is_scc_const+0x52>
mov    -0x10(%rbp),%rdi
call   1040 <is_const@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_scc_const>:
push   %rbx
test   %rsi,%rsi
je     113d <is_scc_const+0x1d>
mov    %rsi,%rbx
call   1030 <triple_is_ubranch@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1141 <is_scc_const+0x21>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <is_const@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
%struct.triple = type { i32 }
define i32 @is_scc_const(%struct.compile_state* %0, %struct.triple* %1) {
%3 = alloca %struct.compile_state*
%4 = alloca %struct.triple*
store %struct.compile_state* %0, %struct.compile_state** %3
store %struct.triple* %1, %struct.triple** %4
%5 = load %struct.triple*, %struct.triple** %4
%6 = icmp ne %struct.triple* %5, null
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load %struct.compile_state*, %struct.compile_state** %3
%9 = load %struct.triple*, %struct.triple** %4
%10 = call i64 @triple_is_ubranch(%struct.compile_state* %8, %struct.triple* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = load %struct.triple*, %struct.triple** %4
%14 = call i64 @is_const(%struct.triple* %13)
%15 = icmp ne i64 %14, 0
br label %16
16: ; preds = %12, %7
%17 = phi i1 [ true, %7 ], [ %15, %12 ]
br label %18
18: ; preds = %16, %2
%19 = phi i1 [ false, %2 ], [ %17, %16 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.triple = type { i32 }
define i32 @is_scc_const(%struct.compile_state* %0, %struct.triple* %1) {
%3 = icmp eq %struct.triple* %1, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = tail call i64 @triple_is_ubranch(%struct.compile_state* %0, %struct.triple* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i64 @is_const(%struct.triple* %1)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %7, %2
%12 = phi i32 [ 0, %2 ], [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}