#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*/ determineMode(int);
int /*<<< orphan*/ setMode(int, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void setFreq(int fd, char vfo, int hz) {
  char cmd[15];
  sprintf(cmd, "F%c%011d;", vfo, hz);
  write(fd, cmd, strlen(cmd));
  usleep(100e3);
  setMode(fd, determineMode(hz));
}


x86 assembly (clang, -O0):
<setFreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0x1b(%rbp),%rdi
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%ecx
lea    0xe7b(%rip),%rsi
movsbl %al,%edx
call   1070 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x1b(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x1b(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <determineMode@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1060 <setMode@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setFreq>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebp
mov    %esi,%edx
mov    %edi,%ebx
lea    0xe8b(%rip),%rsi
lea    0x1(%rsp),%r14
mov    %r14,%rdi
mov    %ebp,%ecx
call   1070 <sprintf@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    %ebp,%edi
call   1030 <determineMode@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <setMode@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"F%c%011d;\00"
define void @setFreq(i32 %0, i8 signext %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca [15 x i8]
store i32 %0, i32* %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%9 = load i8, i8* %5
%10 = load i32, i32* %6
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext %9, i32 %10)
%12 = load i32, i32* %4
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @write(i32 %12, i8* %13, i32 %15)
%17 = call i32 @usleep(i32 100000)
%18 = load i32, i32* %4
%19 = load i32, i32* %6
%20 = call i32 @determineMode(i32 %19)
%21 = call i32 @setMode(i32 %18, i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"F%c%011d;\00"
define void @setFreq(i32 %0, i8 signext %1, i32 %2) {
%4 = alloca [15 x i8]
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext %1, i32 %2)
%7 = call i32 @strlen(i8* %5)
%8 = call i32 @write(i32 %0, i8* %5, i32 %7)
%9 = call i32 @usleep(i32 100000)
%10 = call i32 @determineMode(i32 %2)
%11 = call i32 @setMode(i32 %0, i32 %10)
ret void
}