#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 */
typedef scalar_t__ tempo;

/* Variables and functions */
int write(int, unsigned char *, int);
int smf_tempo(int fd, unsigned long tempo) {
  unsigned char data[7];
  data[0] = 0x00;
  data[1] = 0xff;
  data[2] = 0x51;
  data[3] = 0x03;
  data[4] = (char)(tempo >> 16) & 0xff;
  data[5] = (char)(tempo >> 8) & 0xff;
  data[6] = (char)(tempo)&0xff;
  return write(fd, data, 7);
}


x86 assembly (clang, -O0):
<smf_tempo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x17(%rbp)
movb   $0xff,-0x16(%rbp)
movb   $0x51,-0x15(%rbp)
movb   $0x3,-0x14(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
movsbl %al,%eax
and    $0xff,%eax
mov    %al,-0x13(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
movsbl %al,%eax
and    $0xff,%eax
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
movsbl %al,%eax
and    $0xff,%eax
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x17(%rbp),%rsi
mov    $0x7,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smf_tempo>:
push   %rax
mov    %rsi,%rax
movl   $0x351ff00,0x1(%rsp)
03
mov    %rsi,%rcx
shr    $0x10,%rcx
mov    %cl,0x5(%rsp)
mov    %ah,0x6(%rsp)
mov    %al,0x7(%rsp)
lea    0x1(%rsp),%rsi
mov    $0x7,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @smf_tempo(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca [7 x i8]
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
store i8 0, i8* %6
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 1
store i8 -1, i8* %7
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 2
store i8 81, i8* %8
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 3
store i8 3, i8* %9
%10 = load i64, i64* %4
%11 = lshr i64 %10, 16
%12 = trunc i64 %11 to i8
%13 = sext i8 %12 to i32
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 4
store i8 %15, i8* %16
%17 = load i64, i64* %4
%18 = lshr i64 %17, 8
%19 = trunc i64 %18 to i8
%20 = sext i8 %19 to i32
%21 = and i32 %20, 255
%22 = trunc i32 %21 to i8
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 5
store i8 %22, i8* %23
%24 = load i64, i64* %4
%25 = trunc i64 %24 to i8
%26 = sext i8 %25 to i32
%27 = and i32 %26, 255
%28 = trunc i32 %27 to i8
%29 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 6
store i8 %28, i8* %29
%30 = load i32, i32* %3
%31 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%32 = call i32 @write(i32 %30, i8* %31, i32 7)
ret i32 %32
}

LLVM IR (-O2):
define i32 @smf_tempo(i32 %0, i64 %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 0, i8* %4
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 1
store i8 -1, i8* %5
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 2
store i8 81, i8* %6
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 3
store i8 3, i8* %7
%8 = lshr i64 %1, 16
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 4
store i8 %9, i8* %10
%11 = lshr i64 %1, 8
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 5
store i8 %12, i8* %13
%14 = trunc i64 %1 to i8
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 6
store i8 %14, i8* %15
%16 = call i32 @write(i32 %0, i8* %4, i32 7)
ret i32 %16
}