#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 clk {
  int dummy;
};

/* Variables and functions */
int clk_enable(struct clk *);
int clk_prepare(struct clk *);
int /*<<< orphan*/ clk_unprepare(struct clk *);
int clk_prepare_enable(struct clk *clk) {
  int ret;
  ret = clk_prepare(clk);
  if (ret)
    return ret;
  ret = clk_enable(clk);
  if (ret)
    clk_unprepare(clk);
  return ret;
}


x86 assembly (clang, -O0):
<clk_prepare_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <clk_prepare@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     115d <clk_prepare_enable+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1182 <clk_prepare_enable+0x52>
mov    -0x10(%rbp),%rdi
call   1040 <clk_enable@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     117c <clk_prepare_enable+0x4c>
mov    -0x10(%rbp),%rdi
call   1030 <clk_unprepare@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clk_prepare_enable>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <clk_prepare@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    115b <clk_prepare_enable+0x2b>
mov    %rbx,%rdi
call   1040 <clk_enable@plt>
test   %eax,%eax
je     1159 <clk_prepare_enable+0x29>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <clk_unprepare@plt>
jmp    115b <clk_prepare_enable+0x2b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.clk = type { i32 }
define i32 @clk_prepare_enable(%struct.clk* %0) {
%2 = alloca i32
%3 = alloca %struct.clk*
%4 = alloca i32
store %struct.clk* %0, %struct.clk** %3
%5 = load %struct.clk*, %struct.clk** %3
%6 = call i32 @clk_prepare(%struct.clk* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %21
11: ; preds = %1
%12 = load %struct.clk*, %struct.clk** %3
%13 = call i32 @clk_enable(%struct.clk* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load %struct.clk*, %struct.clk** %3
%18 = call i32 @clk_unprepare(%struct.clk* %17)
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %4
store i32 %20, i32* %2
br label %21
21: ; preds = %19, %9
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct.clk = type { i32 }
define i32 @clk_prepare_enable(%struct.clk* %0) {
%2 = tail call i32 @clk_prepare(%struct.clk* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @clk_enable(%struct.clk* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @clk_unprepare(%struct.clk* %0)
br label %9
9: ; preds = %4, %7, %1
%10 = phi i32 [ %2, %1 ], [ %5, %7 ], [ 0, %4 ]
ret i32 %10
}