#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*/ usleep(int);
int /*<<< orphan*/ write_cmd(char *);
void *msg_send_cmd(void *arg) {
  char *cmd[] = {"get_file_name\n",   "get_meta_album\n",  "get_meta_artist\n",
                 "get_percent_pos\n", "get_time_length\n", "get_time_pos\n"};
  int i = 0;
  while (1) {
    for (i = 0; i < 6; i++) {
      usleep(100 * 1000);
      write_cmd(cmd[i]);
    }
  }
}


x86 assembly (clang, -O0):
<msg_send_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
lea    0xead(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xeb1(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xeb6(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xebc(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xec8(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x6,-0x44(%rbp)
jge    11cc <msg_send_cmd+0x9c>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1040 <write_cmd@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    119c <msg_send_cmd+0x6c>
jmp    1195 <msg_send_cmd+0x65>

x86 assembly (clang, -O2):
<msg_send_cmd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%r14
lea    0xed6(%rip),%r15
lea    0xedf(%rip),%r12
lea    0xee9(%rip),%r13
lea    0xef3(%rip),%rbx
lea    0xefd(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    %r14,%rdi
call   1030 <write_cmd@plt>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    %r15,%rdi
call   1030 <write_cmd@plt>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    %r12,%rdi
call   1030 <write_cmd@plt>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    %r13,%rdi
call   1030 <write_cmd@plt>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    %rbx,%rdi
call   1030 <write_cmd@plt>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    %rbp,%rdi
call   1030 <write_cmd@plt>
jmp    1160 <msg_send_cmd+0x40>

LLVM IR (-O0):
@.str = [15 x i8] c"get_file_name\0A\00"
@.str.1 = [16 x i8] c"get_meta_album\0A\00"
@.str.2 = [17 x i8] c"get_meta_artist\0A\00"
@.str.3 = [17 x i8] c"get_percent_pos\0A\00"
@.str.4 = [17 x i8] c"get_time_length\0A\00"
@.str.5 = [14 x i8] c"get_time_pos\0A\00"
define i8* @msg_send_cmd(i8* %0) {
%2 = alloca i8*
%3 = alloca [6 x i8*]
%4 = alloca i32
store i8* %0, i8** %2
%5 = bitcast [6 x i8*]* %3 to i8*
%6 = bitcast i8* %5 to [6 x i8*]*
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 3
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 4
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i32 0, i32 5
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i32 0, i32 0), i8** %12
store i32 0, i32* %4
br label %13
13: ; preds = %1, %27
store i32 0, i32* %4
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 6
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = call i32 @usleep(i32 100000)
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @write_cmd(i8* %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %14
27: ; preds = %14
br label %13
}

LLVM IR (-O2):
@.str = [15 x i8] c"get_file_name\0A\00"
@.str.1 = [16 x i8] c"get_meta_album\0A\00"
@.str.2 = [17 x i8] c"get_meta_artist\0A\00"
@.str.3 = [17 x i8] c"get_percent_pos\0A\00"
@.str.4 = [17 x i8] c"get_time_length\0A\00"
@.str.5 = [14 x i8] c"get_time_pos\0A\00"
define noalias i8* @msg_send_cmd(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @usleep(i32 100000)
%4 = tail call i32 @write_cmd(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @usleep(i32 100000)
%6 = tail call i32 @write_cmd(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @usleep(i32 100000)
%8 = tail call i32 @write_cmd(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @usleep(i32 100000)
%10 = tail call i32 @write_cmd(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @usleep(i32 100000)
%12 = tail call i32 @write_cmd(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i32 @usleep(i32 100000)
%14 = tail call i32 @write_cmd(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %2
}