#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 */
struct triple **triple_lhs(struct compile_state *, struct triple *,
                           struct triple **);
int /*<<< orphan*/ unuse_triple(struct triple *, struct triple *);
void unuse_lhs(struct compile_state *state, struct triple *ins) {
  struct triple **expr;
  expr = triple_lhs(state, ins, 0);
  for (; expr; expr = triple_lhs(state, ins, expr)) {
    unuse_triple(*expr, ins);
    *expr = 0;
  }
}


x86 assembly (clang, -O0):
<unuse_lhs>:
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   1040 <triple_lhs@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1185 <unuse_lhs+0x65>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <unuse_triple@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <triple_lhs@plt>
mov    %rax,-0x18(%rbp)
jmp    1145 <unuse_lhs+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unuse_lhs>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %edx,%edx
call   1040 <triple_lhs@plt>
test   %rax,%rax
je     1168 <unuse_lhs+0x48>
mov    %rax,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
mov    %r15,%rsi
call   1030 <unuse_triple@plt>
movq   $0x0,(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <triple_lhs@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1140 <unuse_lhs+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
%struct.triple = type { i32 }
define void @unuse_lhs(%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_lhs(%struct.compile_state* %6, %struct.triple* %7, %struct.triple** null)
store %struct.triple** %8, %struct.triple*** %5
br label %9
9: ; preds = %18, %2
%10 = load %struct.triple**, %struct.triple*** %5
%11 = icmp ne %struct.triple** %10, null
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = load %struct.triple**, %struct.triple*** %5
%14 = load %struct.triple*, %struct.triple** %13
%15 = load %struct.triple*, %struct.triple** %4
%16 = call i32 @unuse_triple(%struct.triple* %14, %struct.triple* %15)
%17 = load %struct.triple**, %struct.triple*** %5
store %struct.triple* null, %struct.triple** %17
br label %18
18: ; preds = %12
%19 = load %struct.compile_state*, %struct.compile_state** %3
%20 = load %struct.triple*, %struct.triple** %4
%21 = load %struct.triple**, %struct.triple*** %5
%22 = call %struct.triple** @triple_lhs(%struct.compile_state* %19, %struct.triple* %20, %struct.triple** %21)
store %struct.triple** %22, %struct.triple*** %5
br label %9
23: ; preds = %9
ret void
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.triple = type { i32 }
define void @unuse_lhs(%struct.compile_state* %0, %struct.triple* %1) {
%3 = tail call %struct.triple** @triple_lhs(%struct.compile_state* %0, %struct.triple* %1, %struct.triple** null)
%4 = icmp eq %struct.triple** %3, null
br i1 %4, label %11, label %5
5: ; preds = %2, %5
%6 = phi %struct.triple** [ %9, %5 ], [ %3, %2 ]
%7 = load %struct.triple*, %struct.triple** %6
%8 = tail call i32 @unuse_triple(%struct.triple* %7, %struct.triple* %1)
store %struct.triple* null, %struct.triple** %6
%9 = tail call %struct.triple** @triple_lhs(%struct.compile_state* %0, %struct.triple* %1, %struct.triple** %6)
%10 = icmp eq %struct.triple** %9, null
br i1 %10, label %11, label %5
11: ; preds = %5, %2
ret void
}