#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*/ printf(char *, int);
int /*<<< orphan*/ set_angle(int, int);
int /*<<< orphan*/ set_speed(int, int);
int system(char *);
void init_servos() {
  int rc;
  rc = system("echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd");
  rc = system("echo 0 > /sys/kernel/debug/omap_mux/uart1_txd");
  if (rc)
    printf("Error (%d) setting up UART.\n", rc);
  set_speed(0, 5);
  set_speed(1, 5);
  set_angle(0, 90);
  set_angle(1, 90);
}


x86 assembly (clang, -O0):
<init_servos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x4(%rbp)
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     117f <init_servos+0x3f>
mov    -0x4(%rbp),%esi
lea    0xee3(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x5,%esi
call   1050 <set_speed@plt>
mov    $0x1,%edi
mov    $0x5,%esi
call   1050 <set_speed@plt>
xor    %edi,%edi
mov    $0x5a,%esi
call   1060 <set_angle@plt>
mov    $0x1,%edi
mov    $0x5a,%esi
call   1060 <set_angle@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_servos>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <system@plt>
lea    0xedb(%rip),%rdi
call   1030 <system@plt>
test   %eax,%eax
je     116b <init_servos+0x2b>
lea    0xef9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x5,%esi
call   1050 <set_speed@plt>
mov    $0x1,%edi
mov    $0x5,%esi
call   1050 <set_speed@plt>
xor    %edi,%edi
mov    $0x5a,%esi
call   1060 <set_angle@plt>
mov    $0x1,%edi
mov    $0x5a,%esi
pop    %rax
jmp    1060 <set_angle@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd\00"
@.str.1 = [46 x i8] c"echo 0 > /sys/kernel/debug/omap_mux/uart1_txd\00"
@.str.2 = [29 x i8] c"Error (%d) setting up UART.\0A\00"
define void @init_servos() {
%1 = alloca i32
%2 = call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = call i32 @system(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %0
%10 = call i32 @set_speed(i32 0, i32 5)
%11 = call i32 @set_speed(i32 1, i32 5)
%12 = call i32 @set_angle(i32 0, i32 90)
%13 = call i32 @set_angle(i32 1, i32 90)
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"echo 20 > /sys/kernel/debug/omap_mux/uart1_rxd\00"
@.str.1 = [46 x i8] c"echo 0 > /sys/kernel/debug/omap_mux/uart1_txd\00"
@.str.2 = [29 x i8] c"Error (%d) setting up UART.\0A\00"
define void @init_servos() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %2)
br label %6
6: ; preds = %4, %0
%7 = tail call i32 @set_speed(i32 0, i32 5)
%8 = tail call i32 @set_speed(i32 1, i32 5)
%9 = tail call i32 @set_angle(i32 0, i32 90)
%10 = tail call i32 @set_angle(i32 1, i32 90)
ret void
}