#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 isapnpDevice {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int compareDevice(struct device *, struct device *);
int devCmp(void *, void *);
int isapnpCompareDevice(struct isapnpDevice *dev1, struct isapnpDevice *dev2) {
  int x = compareDevice((struct device *)dev1, (struct device *)dev2);
  if (x)
    return x;
  return devCmp((void *)dev1, (void *)dev2);
}


x86 assembly (clang, -O0):
<isapnpCompareDevice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <compareDevice@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1155 <isapnpCompareDevice+0x35>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <isapnpCompareDevice+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <devCmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isapnpCompareDevice>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <compareDevice@plt>
test   %eax,%eax
je     113b <isapnpCompareDevice+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <devCmp@plt>

LLVM IR (-O0):
%struct.isapnpDevice = type { i32 }
%struct.device = type { i32 }
define i32 @isapnpCompareDevice(%struct.isapnpDevice* %0, %struct.isapnpDevice* %1) {
%3 = alloca i32
%4 = alloca %struct.isapnpDevice*
%5 = alloca %struct.isapnpDevice*
%6 = alloca i32
store %struct.isapnpDevice* %0, %struct.isapnpDevice** %4
store %struct.isapnpDevice* %1, %struct.isapnpDevice** %5
%7 = load %struct.isapnpDevice*, %struct.isapnpDevice** %4
%8 = bitcast %struct.isapnpDevice* %7 to %struct.device*
%9 = load %struct.isapnpDevice*, %struct.isapnpDevice** %5
%10 = bitcast %struct.isapnpDevice* %9 to %struct.device*
%11 = call i32 @compareDevice(%struct.device* %8, %struct.device* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %6
store i32 %15, i32* %3
br label %22
16: ; preds = %2
%17 = load %struct.isapnpDevice*, %struct.isapnpDevice** %4
%18 = bitcast %struct.isapnpDevice* %17 to i8*
%19 = load %struct.isapnpDevice*, %struct.isapnpDevice** %5
%20 = bitcast %struct.isapnpDevice* %19 to i8*
%21 = call i32 @devCmp(i8* %18, i8* %20)
store i32 %21, i32* %3
br label %22
22: ; preds = %16, %14
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
%struct.isapnpDevice = type { i32 }
%struct.device = type { i32 }
define i32 @isapnpCompareDevice(%struct.isapnpDevice* %0, %struct.isapnpDevice* %1) {
%3 = bitcast %struct.isapnpDevice* %0 to %struct.device*
%4 = bitcast %struct.isapnpDevice* %1 to %struct.device*
%5 = tail call i32 @compareDevice(%struct.device* %3, %struct.device* %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = bitcast %struct.isapnpDevice* %0 to i8*
%9 = bitcast %struct.isapnpDevice* %1 to i8*
%10 = tail call i32 @devCmp(i8* %8, i8* %9)
br label %11
11: ; preds = %2, %7
%12 = phi i32 [ %10, %7 ], [ %5, %2 ]
ret i32 %12
}