#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 *, char *);
int /*<<< orphan*/ writeToFile(char *, char *);
void flashLED(char *led) {
  char filename[255];
  sprintf(filename, "%s/trigger", led);
  writeToFile(filename, "timer");
  sprintf(filename, "%s/delay_on", led);
  writeToFile(filename, "200");
  sprintf(filename, "%s/delay_off", led);
  writeToFile(filename, "200");
}


x86 assembly (clang, -O0):
<flashLED>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <writeToFile@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xea6(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <writeToFile@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <writeToFile@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flashLED>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rbx
lea    0xeca(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <sprintf@plt>
lea    0xec0(%rip),%rsi
mov    %r14,%rdi
call   1030 <writeToFile@plt>
lea    0xeb7(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <sprintf@plt>
lea    0xeb1(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <writeToFile@plt>
lea    0xea3(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <writeToFile@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s/trigger\00"
@.str.1 = [6 x i8] c"timer\00"
@.str.2 = [12 x i8] c"%s/delay_on\00"
@.str.3 = [4 x i8] c"200\00"
@.str.4 = [13 x i8] c"%s/delay_off\00"
define void @flashLED(i8* %0) {
%2 = alloca i8*
%3 = alloca [255 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%8 = call i32 @writeToFile(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%13 = call i32 @writeToFile(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%15 = load i8*, i8** %2
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%18 = call i32 @writeToFile(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s/trigger\00"
@.str.1 = [6 x i8] c"timer\00"
@.str.2 = [12 x i8] c"%s/delay_on\00"
@.str.3 = [4 x i8] c"200\00"
@.str.4 = [13 x i8] c"%s/delay_off\00"
define void @flashLED(i8* %0) {
%2 = alloca [255 x i8]
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @writeToFile(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%7 = call i32 @writeToFile(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%9 = call i32 @writeToFile(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}