#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
void digitalWrite(int portNumber, int portStatus) {
  char command[50];
  char portString[2];
  char statusString[2];
  sprintf(portString, "%d", portNumber);
  sprintf(statusString, "%d", portStatus);
  strcpy(command, "gpio write ");
  strcat(command, portString);
  strcat(command, " ");
  strcat(command, statusString);
  system(command);
}


x86 assembly (clang, -O0):
<digitalWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x42(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea4(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x44(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe91(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x40(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
lea    -0x42(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x40(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x40(%rbp),%rdi
lea    -0x44(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x40(%rbp),%rdi
call   1040 <system@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitalWrite>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebx
mov    %edi,%edx
lea    0xeaa(%rip),%r14
lea    0xe(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <sprintf@plt>
lea    0xc(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1060 <sprintf@plt>
lea    0xe84(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
lea    0xe6f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"gpio write \00"
@.str.2 = [2 x i8] c" \00"
define void @digitalWrite(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [50 x i8]
%6 = alloca [2 x i8]
%7 = alloca [2 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%12 = load i32, i32* %4
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%18 = call i32 @strcat(i8* %16, i8* %17)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%20 = call i32 @strcat(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%23 = call i32 @strcat(i8* %21, i8* %22)
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%25 = call i32 @system(i8* %24)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"gpio write \00"
@.str.2 = [2 x i8] c" \00"
define void @digitalWrite(i32 %0, i32 %1) {
%3 = alloca [50 x i8]
%4 = alloca [2 x i8]
%5 = alloca [2 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%9 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%10 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%11 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @strcat(i8* %6, i8* %7)
%13 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @strcat(i8* %6, i8* %8)
%15 = call i32 @system(i8* %6)
ret void
}