#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 */
scalar_t__ strcmp(char *, char *);
int write_block(int, int, int, int /*<<< orphan*/);
int pinMode(int pin, char *mode) {
  if (strcmp(mode, "ÏNPUT") == 0)
    return write_block(16, pin, 0, 0);
  else if (strcmp(mode, "OUTPUT") == 0)
    return write_block(16, pin, 1, 0);
  return -1;
}


x86 assembly (clang, -O0):
<pinMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1162 <pinMode+0x42>
mov    -0x8(%rbp),%esi
mov    $0x10,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <write_block@plt>
mov    %eax,-0x4(%rbp)
jmp    11a4 <pinMode+0x84>
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <pinMode+0x78>
mov    -0x8(%rbp),%esi
mov    $0x10,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <write_block@plt>
mov    %eax,-0x4(%rbp)
jmp    11a4 <pinMode+0x84>
jmp    119d <pinMode+0x7d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pinMode>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xed1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     115c <pinMode+0x3c>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1160 <pinMode+0x40>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edx,%edx
jmp    1165 <pinMode+0x45>
mov    $0x1,%edx
mov    $0x10,%edi
mov    %ebp,%esi
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write_block@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\C3\8FNPUT\00"
@.str.1 = [7 x i8] c"OUTPUT\00"
define i32 @pinMode(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @write_block(i32 16, i32 %10, i32 0, i32 0)
store i32 %11, i32* %3
br label %21
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %4
%18 = call i32 @write_block(i32 16, i32 %17, i32 1, i32 0)
store i32 %18, i32* %3
br label %21
19: ; preds = %12
br label %20
20: ; preds = %19
store i32 -1, i32* %3
br label %21
21: ; preds = %20, %16, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [7 x i8] c"\C3\8FNPUT\00"
@.str.1 = [7 x i8] c"OUTPUT\00"
define i32 @pinMode(i32 %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5, %2
%9 = phi i32 [ 0, %2 ], [ 1, %5 ]
%10 = tail call i32 @write_block(i32 16, i32 %0, i32 %9, i32 0)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ -1, %5 ], [ %10, %8 ]
ret i32 %12
}