#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 gl_sampler_object {
  int dummy;
};
struct gl_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _mesa_reference_sampler_object_(struct gl_context *,
                                                   struct gl_sampler_object **,
                                                   struct gl_sampler_object *);
void _mesa_reference_sampler_object(struct gl_context *ctx,
                                    struct gl_sampler_object **ptr,
                                    struct gl_sampler_object *samp) {
  if (*ptr != samp)
    _mesa_reference_sampler_object_(ctx, ptr, samp);
}


x86 assembly (clang, -O0):
<_mesa_reference_sampler_object>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
je     1146 <_mesa_reference_sampler_object+0x36>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <_mesa_reference_sampler_object_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mesa_reference_sampler_object>:
cmp    %rdx,(%rsi)
je     111a <_mesa_reference_sampler_object+0xa>
jmp    1030 <_mesa_reference_sampler_object_@plt>
ret

LLVM IR (-O0):
%struct.gl_context = type { i32 }
%struct.gl_sampler_object = type { i32 }
define void @_mesa_reference_sampler_object(%struct.gl_context* %0, %struct.gl_sampler_object** %1, %struct.gl_sampler_object* %2) {
%4 = alloca %struct.gl_context*
%5 = alloca %struct.gl_sampler_object**
%6 = alloca %struct.gl_sampler_object*
store %struct.gl_context* %0, %struct.gl_context** %4
store %struct.gl_sampler_object** %1, %struct.gl_sampler_object*** %5
store %struct.gl_sampler_object* %2, %struct.gl_sampler_object** %6
%7 = load %struct.gl_sampler_object**, %struct.gl_sampler_object*** %5
%8 = load %struct.gl_sampler_object*, %struct.gl_sampler_object** %7
%9 = load %struct.gl_sampler_object*, %struct.gl_sampler_object** %6
%10 = icmp ne %struct.gl_sampler_object* %8, %9
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load %struct.gl_context*, %struct.gl_context** %4
%13 = load %struct.gl_sampler_object**, %struct.gl_sampler_object*** %5
%14 = load %struct.gl_sampler_object*, %struct.gl_sampler_object** %6
%15 = call i32 @_mesa_reference_sampler_object_(%struct.gl_context* %12, %struct.gl_sampler_object** %13, %struct.gl_sampler_object* %14)
br label %16
16: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
%struct.gl_context = type { i32 }
%struct.gl_sampler_object = type { i32 }
define void @_mesa_reference_sampler_object(%struct.gl_context* %0, %struct.gl_sampler_object** %1, %struct.gl_sampler_object* %2) {
%4 = load %struct.gl_sampler_object*, %struct.gl_sampler_object** %1
%5 = icmp eq %struct.gl_sampler_object* %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @_mesa_reference_sampler_object_(%struct.gl_context* %0, %struct.gl_sampler_object** %1, %struct.gl_sampler_object* %2)
br label %8
8: ; preds = %6, %3
ret void
}