#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*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int write(int, int *, int);
void launcher_cmd(int fd, int cmd) {
  int retval = 0;
  retval = write(fd, &cmd, 1);
  if (retval < 0) {
    fprintf(stderr,
            "Could not send command to "
            "/dev/launcher0"
            " (error %d)\n",
            retval);
  } else if (0x10 == cmd) {
    usleep(5000000);
  }
}


x86 assembly (clang, -O0):
<launcher_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1180 <launcher_cmd+0x50>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
jmp    119d <launcher_cmd+0x6d>
mov    $0x10,%eax
cmp    -0x8(%rbp),%eax
jne    1198 <launcher_cmd+0x68>
mov    $0x4c4b40,%edi
call   1050 <usleep@plt>
jmp    119d <launcher_cmd+0x6d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<launcher_cmd>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
test   %eax,%eax
js     1162 <launcher_cmd+0x32>
cmp    $0x10,%ebx
jne    117e <launcher_cmd+0x4e>
mov    $0x4c4b40,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <usleep@plt>
mov    0x2e77(%rip),%rcx
mov    (%rcx),%edi
lea    0xe8e(%rip),%rsi
mov    %eax,%edx
add    $0x10,%rsp
pop    %rbx
jmp    1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"Could not send command to /dev/launcher0 (error %d)\0A\00"
define void @launcher_cmd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = call i32 @write(i32 %6, i32* %4, i32 1)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i32, i32* %5
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %20
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp eq i32 16, %15
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @usleep(i32 5000000)
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %10
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Could not send command to /dev/launcher0 (error %d)\0A\00"
define void @launcher_cmd(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @write(i32 %0, i32* %3, i32 1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %13
9: ; preds = %2
%10 = icmp eq i32 %1, 16
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @usleep(i32 5000000)
br label %13
13: ; preds = %9, %11, %6
ret void
}