#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ intToChar(int, char *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
void initDigitalPort(int port) {
  char command[100] = "echo ";
  char no_pin[2] = "";
  char comman_end[100] = " > /sys/class/gpio/export";
  int j = port;
  intToChar(j, no_pin);
  strcat(command, no_pin);
  strcat(command, comman_end);
  FILE *TestConsole = popen(command, "w");
  fclose(TestConsole);
}


x86 assembly (clang, -O0):
<initDigitalPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x65,-0x70(%rbp)
movb   $0x63,-0x6f(%rbp)
movb   $0x68,-0x6e(%rbp)
movb   $0x6f,-0x6d(%rbp)
movb   $0x20,-0x6c(%rbp)
lea    -0x72(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <memset@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe50(%rip),%rsi
mov    $0x64,%edx
call   1050 <memcpy@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0xe4(%rbp),%edi
lea    -0x72(%rbp),%rsi
call   1070 <intToChar@plt>
lea    -0x70(%rbp),%rdi
lea    -0x72(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,-0xf0(%rbp)
mov    -0xf0(%rbp),%rdi
call   1030 <fclose@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initDigitalPort>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x70(%rsp)
movl   $0x6f686365,0x10(%rsp)
6f
movb   $0x20,0x14(%rsp)
movw   $0x0,0xe(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xe84(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xe65(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xe46(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xe27(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xe0(%rsp)
lea    0xe(%rsp),%r14
mov    %r14,%rsi
call   1050 <intToChar@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0x80(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1040 <popen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.initDigitalPort.comman_end = [100 x i8] c" > /sys/class/gpio/export\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"w\00"
define void @initDigitalPort(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [2 x i8]
%5 = alloca [100 x i8]
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %2
%8 = bitcast [100 x i8]* %3 to i8*
%9 = bitcast i8* %8 to [100 x i8]*
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i32 0, i32 0
store i8 101, i8* %10
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i32 0, i32 1
store i8 99, i8* %11
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i32 0, i32 2
store i8 104, i8* %12
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i32 0, i32 3
store i8 111, i8* %13
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i32 0, i32 4
store i8 32, i8* %14
%15 = bitcast [2 x i8]* %4 to i8*
%16 = bitcast [100 x i8]* %5 to i8*
%17 = load i32, i32* %2
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%20 = call i32 @intToChar(i32 %18, i8* %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%23 = call i32 @strcat(i8* %21, i8* %22)
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%28 = call i32* @popen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %28, i32** %7
%29 = load i32*, i32** %7
%30 = call i32 @fclose(i32* %29)
ret void
}

LLVM IR (-O2):
@__const.initDigitalPort.comman_end = [100 x i8] c" > /sys/class/gpio/export\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"w\00"
define void @initDigitalPort(i32 %0) {
%2 = alloca [100 x i8]
%3 = alloca i16
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8 101, i8* %5
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 1
store i8 99, i8* %6
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 2
store i8 104, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 3
store i8 111, i8* %8
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 4
store i8 32, i8* %9
%10 = bitcast i16* %3 to i8*
store i16 0, i16* %3
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%12 = call i32 @intToChar(i32 %0, i8* %10)
%13 = call i32 @strcat(i8* %5, i8* %10)
%14 = call i32 @strcat(i8* %5, i8* %11)
%15 = call i32* @popen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @fclose(i32* %15)
ret void
}