#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*/ delay(int);
int getSonarDistance(int, int);
int getPos(int SonarTriggerAvant, int SonarTriggerArriere,
           int SonarTriggerDroite, int SonarTriggerGauche, int SonarEchoAvant,
           int SonarEchoArriere, int SonarEchoDroite, int SonarEchoGauche) {
  int mmAvant, mmArriere, mmDroite, mmGauche;
  mmAvant = getSonarDistance(SonarTriggerAvant, SonarEchoAvant);
  delay(10);
  mmArriere = getSonarDistance(SonarTriggerArriere, SonarEchoArriere);
  delay(10);
  mmDroite = getSonarDistance(SonarTriggerDroite, SonarEchoDroite);
  delay(10);
  mmGauche = getSonarDistance(SonarTriggerGauche, SonarEchoGauche);
  delay(10);
  return mmAvant, mmArriere, mmDroite, mmGauche;
}


x86 assembly (clang, -O0):
<getPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <getSonarDistance@plt>
mov    %eax,-0x1c(%rbp)
mov    $0xa,%edi
call   1030 <delay@plt>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <getSonarDistance@plt>
mov    %eax,-0x20(%rbp)
mov    $0xa,%edi
call   1030 <delay@plt>
mov    -0xc(%rbp),%edi
mov    0x10(%rbp),%esi
call   1040 <getSonarDistance@plt>
mov    %eax,-0x24(%rbp)
mov    $0xa,%edi
call   1030 <delay@plt>
mov    -0x10(%rbp),%edi
mov    0x18(%rbp),%esi
call   1040 <getSonarDistance@plt>
mov    %eax,-0x28(%rbp)
mov    $0xa,%edi
call   1030 <delay@plt>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%ebp
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebx
mov    0x48(%rsp),%r14d
mov    0x40(%rsp),%r13d
mov    %r8d,%esi
call   1040 <getSonarDistance@plt>
mov    $0xa,%edi
call   1030 <delay@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <getSonarDistance@plt>
mov    $0xa,%edi
call   1030 <delay@plt>
mov    %r12d,%edi
mov    %r13d,%esi
call   1040 <getSonarDistance@plt>
mov    $0xa,%edi
call   1030 <delay@plt>
mov    %r15d,%edi
mov    %r14d,%esi
call   1040 <getSonarDistance@plt>
mov    %eax,%ebx
mov    $0xa,%edi
call   1030 <delay@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getPos(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%21 = load i32, i32* %9
%22 = load i32, i32* %13
%23 = call i32 @getSonarDistance(i32 %21, i32 %22)
store i32 %23, i32* %17
%24 = call i32 @delay(i32 10)
%25 = load i32, i32* %10
%26 = load i32, i32* %14
%27 = call i32 @getSonarDistance(i32 %25, i32 %26)
store i32 %27, i32* %18
%28 = call i32 @delay(i32 10)
%29 = load i32, i32* %11
%30 = load i32, i32* %15
%31 = call i32 @getSonarDistance(i32 %29, i32 %30)
store i32 %31, i32* %19
%32 = call i32 @delay(i32 10)
%33 = load i32, i32* %12
%34 = load i32, i32* %16
%35 = call i32 @getSonarDistance(i32 %33, i32 %34)
store i32 %35, i32* %20
%36 = call i32 @delay(i32 10)
%37 = load i32, i32* %17
%38 = load i32, i32* %18
%39 = load i32, i32* %19
%40 = load i32, i32* %20
ret i32 %40
}

LLVM IR (-O2):
define i32 @getPos(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call i32 @getSonarDistance(i32 %0, i32 %4)
%10 = tail call i32 @delay(i32 10)
%11 = tail call i32 @getSonarDistance(i32 %1, i32 %5)
%12 = tail call i32 @delay(i32 10)
%13 = tail call i32 @getSonarDistance(i32 %2, i32 %6)
%14 = tail call i32 @delay(i32 10)
%15 = tail call i32 @getSonarDistance(i32 %3, i32 %7)
%16 = tail call i32 @delay(i32 10)
ret i32 %15
}