#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 */
int /*<<< orphan*/ internal_error(struct compile_state *, struct triple *,
                                  char *);
struct triple **triple_misc(struct compile_state *, struct triple *,
                            struct triple **);
void check_misc(struct compile_state *state, struct triple *ins) {
  struct triple **expr;
  expr = triple_misc(state, ins, 0);
  for (; expr; expr = triple_misc(state, ins, expr)) {
    if (*expr) {
      internal_error(state, ins, "unexpected misc");
    }
  }
}


x86 assembly (clang, -O0):
<check_misc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <triple_misc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1191 <check_misc+0x71>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1172 <check_misc+0x52>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xe93(%rip),%rdx
call   1040 <internal_error@plt>
jmp    1177 <check_misc+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <triple_misc@plt>
mov    %rax,-0x18(%rbp)
jmp    1145 <check_misc+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_misc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edx,%edx
call   1030 <triple_misc@plt>
test   %rax,%rax
je     117c <check_misc+0x5c>
mov    %rax,%rbx
lea    0xebc(%rip),%r12
jmp    1166 <check_misc+0x46>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <triple_misc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     117c <check_misc+0x5c>
cmpq   $0x0,(%rbx)
je     1150 <check_misc+0x30>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <internal_error@plt>
jmp    1150 <check_misc+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
%struct.triple = type { i32 }
@.str = [16 x i8] c"unexpected misc\00"
define void @check_misc(%struct.compile_state* %0, %struct.triple* %1) {
%3 = alloca %struct.compile_state*
%4 = alloca %struct.triple*
%5 = alloca %struct.triple**
store %struct.compile_state* %0, %struct.compile_state** %3
store %struct.triple* %1, %struct.triple** %4
%6 = load %struct.compile_state*, %struct.compile_state** %3
%7 = load %struct.triple*, %struct.triple** %4
%8 = call %struct.triple** @triple_misc(%struct.compile_state* %6, %struct.triple* %7, %struct.triple** null)
store %struct.triple** %8, %struct.triple*** %5
br label %9
9: ; preds = %21, %2
%10 = load %struct.triple**, %struct.triple*** %5
%11 = icmp ne %struct.triple** %10, null
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = load %struct.triple**, %struct.triple*** %5
%14 = load %struct.triple*, %struct.triple** %13
%15 = icmp ne %struct.triple* %14, null
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load %struct.compile_state*, %struct.compile_state** %3
%18 = load %struct.triple*, %struct.triple** %4
%19 = call i32 @internal_error(%struct.compile_state* %17, %struct.triple* %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %16, %12
br label %21
21: ; preds = %20
%22 = load %struct.compile_state*, %struct.compile_state** %3
%23 = load %struct.triple*, %struct.triple** %4
%24 = load %struct.triple**, %struct.triple*** %5
%25 = call %struct.triple** @triple_misc(%struct.compile_state* %22, %struct.triple* %23, %struct.triple** %24)
store %struct.triple** %25, %struct.triple*** %5
br label %9
26: ; preds = %9
ret void
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.triple = type { i32 }
@.str = [16 x i8] c"unexpected misc\00"
define void @check_misc(%struct.compile_state* %0, %struct.triple* %1) {
%3 = tail call %struct.triple** @triple_misc(%struct.compile_state* %0, %struct.triple* %1, %struct.triple** null)
%4 = icmp eq %struct.triple** %3, null
br i1 %4, label %14, label %5
5: ; preds = %2, %11
%6 = phi %struct.triple** [ %12, %11 ], [ %3, %2 ]
%7 = load %struct.triple*, %struct.triple** %6
%8 = icmp eq %struct.triple* %7, null
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @internal_error(%struct.compile_state* %0, %struct.triple* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %5, %9
%12 = tail call %struct.triple** @triple_misc(%struct.compile_state* %0, %struct.triple* %1, %struct.triple** %6)
%13 = icmp eq %struct.triple** %12, null
br i1 %13, label %14, label %5
14: ; preds = %11, %2
ret void
}