#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*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  printf("hola que tal estas \n");
  char color[6] = "0xFFFFFF";
  int cnt = 0;
  char buffer[8];
  int dispositivo = open("/dev/usb/blinkstick0", O_WRONLY);
  while (1) {
    cnt = cnt % 7;
    write(dispositivo, cnt + ":0x001100", strlen("1:0x001100"));
    cnt += 1;
    usleep(100000);
  }
  close(dispositivo);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
call   1050 <printf@plt>
mov    0xebd(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x12(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
lea    0xe78(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x1c(%rbp),%rcx
lea    0xe67(%rip),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
lea    0xe58(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    %eax,-0x1c(%rbp)
mov    $0x186a0,%edi
call   1070 <usleep@plt>
jmp    11a5 <main+0x55>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
lea    0xe89(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%r12d
xor    %ebx,%ebx
lea    0xe8e(%rip),%r15
lea    0xe86(%rip),%r14
nop
movslq %ebx,%r13
imul   $0xffffffff92492493,%r13,%rbp
shr    $0x20,%rbp
add    %r13d,%ebp
mov    %ebp,%eax
shr    $0x1f,%eax
sar    $0x2,%ebp
add    %eax,%ebp
lea    0x0(,%rbp,8),%eax
sub    %eax,%ebp
lea    0x0(%r13,%rbp,1),%eax
movslq %eax,%rbx
add    %r15,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0x1(%r13,%rbp,1),%ebx
mov    $0x186a0,%edi
call   1070 <usleep@plt>
jmp    1190 <main+0x40>

LLVM IR (-O0):
@.str = [21 x i8] c"hola que tal estas \0A\00"
@__const.main.color = [6 x i8] c"0xFFFF"
@.str.1 = [21 x i8] c"/dev/usb/blinkstick0\00"
@O_WRONLY = global i32 0
@.str.2 = [10 x i8] c":0x001100\00"
@.str.3 = [11 x i8] c"1:0x001100\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i8]
%7 = alloca i32
%8 = alloca [8 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = bitcast [6 x i8]* %6 to i8*
store i32 0, i32* %7
%12 = load i32, i32* @O_WRONLY
%13 = call i32 @open(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 %13, i32* %9
br label %14
14: ; preds = %2, %14
%15 = load i32, i32* %7
%16 = srem i32 %15, 7
store i32 %16, i32* %7
%17 = load i32, i32* %9
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 %19
%21 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @write(i32 %17, i8* %20, i32 %21)
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
%25 = call i32 @usleep(i32 100000)
br label %14
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"/dev/usb/blinkstick0\00"
@O_WRONLY = global i32 0
@.str.2 = [10 x i8] c":0x001100\00"
@.str.3 = [11 x i8] c"1:0x001100\00"
@str = [20 x i8] c"hola que tal estas \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @O_WRONLY
%5 = tail call i32 @open(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %6, %2
%7 = phi i32 [ 0, %2 ], [ %13, %6 ]
%8 = srem i32 %7, 7
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i8], [10 x i8]* @.str.2, i64 0, i64 %9
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @write(i32 %5, i8* %10, i32 %11)
%13 = add nsw i32 %8, 1
%14 = tail call i32 @usleep(i32 100000)
br label %6
}