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

/* Variables and functions */
int hdhomerun_device_set_tuner_target_to_local_protocol(
    struct hdhomerun_device_t *, char *);
int hdhomerun_device_stream_refresh_target(struct hdhomerun_device_t *hd) {
  int ret = hdhomerun_device_set_tuner_target_to_local_protocol(hd, "rtp");
  if (ret == 0) {
    ret = hdhomerun_device_set_tuner_target_to_local_protocol(hd, "udp");
  }
  return ret;
}


x86 assembly (clang, -O0):
<hdhomerun_device_stream_refresh_target>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <hdhomerun_device_set_tuner_target_to_local_protocol@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114c <hdhomerun_device_stream_refresh_target+0x3c>
mov    -0x8(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1030 <hdhomerun_device_set_tuner_target_to_local_protocol@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdhomerun_device_stream_refresh_target>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <hdhomerun_device_set_tuner_target_to_local_protocol@plt>
test   %eax,%eax
je     1126 <hdhomerun_device_stream_refresh_target+0x16>
pop    %rbx
ret
lea    0xed7(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <hdhomerun_device_set_tuner_target_to_local_protocol@plt>

LLVM IR (-O0):
%struct.hdhomerun_device_t = type { i32 }
@.str = [4 x i8] c"rtp\00"
@.str.1 = [4 x i8] c"udp\00"
define i32 @hdhomerun_device_stream_refresh_target(%struct.hdhomerun_device_t* %0) {
%2 = alloca %struct.hdhomerun_device_t*
%3 = alloca i32
store %struct.hdhomerun_device_t* %0, %struct.hdhomerun_device_t** %2
%4 = load %struct.hdhomerun_device_t*, %struct.hdhomerun_device_t** %2
%5 = call i32 @hdhomerun_device_set_tuner_target_to_local_protocol(%struct.hdhomerun_device_t* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load %struct.hdhomerun_device_t*, %struct.hdhomerun_device_t** %2
%10 = call i32 @hdhomerun_device_set_tuner_target_to_local_protocol(%struct.hdhomerun_device_t* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %10, i32* %3
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
%struct.hdhomerun_device_t = type { i32 }
@.str = [4 x i8] c"rtp\00"
@.str.1 = [4 x i8] c"udp\00"
define i32 @hdhomerun_device_stream_refresh_target(%struct.hdhomerun_device_t* %0) {
%2 = tail call i32 @hdhomerun_device_set_tuner_target_to_local_protocol(%struct.hdhomerun_device_t* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @hdhomerun_device_set_tuner_target_to_local_protocol(%struct.hdhomerun_device_t* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
ret i32 %7
}