#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*/ led_off(int);
int /*<<< orphan*/ led_on(int);
int /*<<< orphan*/ motor_off(int);
int /*<<< orphan*/ motor_on(int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ speaker_play(int, int, int);
int /*<<< orphan*/ speaker_stop(int);
void gpio_test(int farm_fd) {
  sleep(1);
  motor_on(farm_fd);
  led_on(farm_fd);
  speaker_play(farm_fd, 500, 1911);
  sleep(3);
  motor_off(farm_fd);
  led_off(farm_fd);
  speaker_stop(farm_fd);
  sleep(1);
  led_on(farm_fd);
  motor_on(farm_fd);
  speaker_play(farm_fd, 500, 1511);
  sleep(3);
  led_off(farm_fd);
  motor_off(farm_fd);
  speaker_stop(farm_fd);
}


x86 assembly (clang, -O0):
<gpio_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    -0x4(%rbp),%edi
call   1090 <motor_on@plt>
mov    -0x4(%rbp),%edi
call   1060 <led_on@plt>
mov    -0x4(%rbp),%edi
mov    $0x1f4,%esi
mov    $0x777,%edx
call   1030 <speaker_play@plt>
mov    $0x3,%edi
call   1080 <sleep@plt>
mov    -0x4(%rbp),%edi
call   1070 <motor_off@plt>
mov    -0x4(%rbp),%edi
call   1040 <led_off@plt>
mov    -0x4(%rbp),%edi
call   1050 <speaker_stop@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    -0x4(%rbp),%edi
call   1060 <led_on@plt>
mov    -0x4(%rbp),%edi
call   1090 <motor_on@plt>
mov    -0x4(%rbp),%edi
mov    $0x1f4,%esi
mov    $0x5e7,%edx
call   1030 <speaker_play@plt>
mov    $0x3,%edi
call   1080 <sleep@plt>
mov    -0x4(%rbp),%edi
call   1040 <led_off@plt>
mov    -0x4(%rbp),%edi
call   1070 <motor_off@plt>
mov    -0x4(%rbp),%edi
call   1050 <speaker_stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_test>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    %ebx,%edi
call   1090 <motor_on@plt>
mov    %ebx,%edi
call   1060 <led_on@plt>
mov    %ebx,%edi
mov    $0x1f4,%esi
mov    $0x777,%edx
call   1030 <speaker_play@plt>
mov    $0x3,%edi
call   1080 <sleep@plt>
mov    %ebx,%edi
call   1070 <motor_off@plt>
mov    %ebx,%edi
call   1040 <led_off@plt>
mov    %ebx,%edi
call   1050 <speaker_stop@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    %ebx,%edi
call   1060 <led_on@plt>
mov    %ebx,%edi
call   1090 <motor_on@plt>
mov    %ebx,%edi
mov    $0x1f4,%esi
mov    $0x5e7,%edx
call   1030 <speaker_play@plt>
mov    $0x3,%edi
call   1080 <sleep@plt>
mov    %ebx,%edi
call   1040 <led_off@plt>
mov    %ebx,%edi
call   1070 <motor_off@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <speaker_stop@plt>

LLVM IR (-O0):
define void @gpio_test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @sleep(i32 1)
%4 = load i32, i32* %2
%5 = call i32 @motor_on(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @led_on(i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @speaker_play(i32 %8, i32 500, i32 1911)
%10 = call i32 @sleep(i32 3)
%11 = load i32, i32* %2
%12 = call i32 @motor_off(i32 %11)
%13 = load i32, i32* %2
%14 = call i32 @led_off(i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @speaker_stop(i32 %15)
%17 = call i32 @sleep(i32 1)
%18 = load i32, i32* %2
%19 = call i32 @led_on(i32 %18)
%20 = load i32, i32* %2
%21 = call i32 @motor_on(i32 %20)
%22 = load i32, i32* %2
%23 = call i32 @speaker_play(i32 %22, i32 500, i32 1511)
%24 = call i32 @sleep(i32 3)
%25 = load i32, i32* %2
%26 = call i32 @led_off(i32 %25)
%27 = load i32, i32* %2
%28 = call i32 @motor_off(i32 %27)
%29 = load i32, i32* %2
%30 = call i32 @speaker_stop(i32 %29)
ret void
}

LLVM IR (-O2):
define void @gpio_test(i32 %0) {
%2 = tail call i32 @sleep(i32 1)
%3 = tail call i32 @motor_on(i32 %0)
%4 = tail call i32 @led_on(i32 %0)
%5 = tail call i32 @speaker_play(i32 %0, i32 500, i32 1911)
%6 = tail call i32 @sleep(i32 3)
%7 = tail call i32 @motor_off(i32 %0)
%8 = tail call i32 @led_off(i32 %0)
%9 = tail call i32 @speaker_stop(i32 %0)
%10 = tail call i32 @sleep(i32 1)
%11 = tail call i32 @led_on(i32 %0)
%12 = tail call i32 @motor_on(i32 %0)
%13 = tail call i32 @speaker_play(i32 %0, i32 500, i32 1511)
%14 = tail call i32 @sleep(i32 3)
%15 = tail call i32 @led_off(i32 %0)
%16 = tail call i32 @motor_off(i32 %0)
%17 = tail call i32 @speaker_stop(i32 %0)
ret void
}