#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 */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int /*<<< orphan*/ stderr;
int cfg_pin(int pin, int output, int val) {
  if (output)
    fprintf(stderr, "cfg p%d, output, %d\n", pin, val);
  else
    fprintf(stderr, "cfg p%d, input, %s\n", pin, val ? "pullup" : "no pullup");
  return 1;
}


x86 assembly (clang, -O0):
<cfg_pin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114d <cfg_pin+0x3d>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    117f <cfg_pin+0x6f>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%esi
lea    0xec6(%rip),%rcx
lea    0xec2(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfg_pin>:
push   %rax
mov    %edx,%ecx
mov    %edi,%edx
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
test   %esi,%esi
je     1132 <cfg_pin+0x22>
lea    0xed7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1154 <cfg_pin+0x44>
test   %ecx,%ecx
lea    0xeee(%rip),%rax
lea    0xeea(%rip),%rcx
cmove  %rax,%rcx
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"cfg p%d, output, %d\0A\00"
@.str.1 = [20 x i8] c"cfg p%d, input, %s\0A\00"
@.str.2 = [7 x i8] c"pullup\00"
@.str.3 = [10 x i8] c"no pullup\00"
define i32 @cfg_pin(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
br label %22
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = load i32, i32* %4
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%21 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %20)
br label %22
22: ; preds = %14, %9
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"cfg p%d, output, %d\0A\00"
@.str.1 = [20 x i8] c"cfg p%d, input, %s\0A\00"
@.str.2 = [7 x i8] c"pullup\00"
@.str.3 = [10 x i8] c"no pullup\00"
define i32 @cfg_pin(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = load i32, i32* @stderr
br i1 %4, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
br label %12
8: ; preds = %3
%9 = icmp eq i32 %2, 0
%10 = select i1 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%11 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8* %10)
br label %12
12: ; preds = %8, %6
ret i32 1
}