#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*/ GP_break30();
int /*<<< orphan*/ GP_break31();
int /*<<< orphan*/ GP_break32();
int /*<<< orphan*/ GP_break33();
int /*<<< orphan*/ MP_impulsscheibe(int);
int MP_lichtschranke(int);
int /*<<< orphan*/ MP_motor(int, int);
int /*<<< orphan*/ MP_p3wait1();
int /*<<< orphan*/ MP_p3wait2();
int /*<<< orphan*/ MP_p3wait3();
int /*<<< orphan*/ MP_p3wait4();
int /*<<< orphan*/ MP_p3wait5();
int /*<<< orphan*/ printf(char *, ...);
void MP_prozess3(void) {
  int PV_weiss_oben = 0;
  char PV_char;
  while (1) {
    GP_break30();
    MP_p3wait1();
    MP_p3wait2();
    printf("DEBUG: Paket ist bis zur Lichtschranke gefahren\n");
    do {
      GP_break31();
      printf("DEBUG: Paket zurueck fahren\n");
      MP_p3wait3();
      printf(
          "DEBUG: Paket ist zurueckgefahren, nun Paketoberflaeche vermessen\n");
      PV_weiss_oben = (MP_lichtschranke(1) == 1);
      printf("DEBUG: Lichtschranke= %d\n", PV_weiss_oben);
      if (PV_weiss_oben) {
        GP_break32();
        printf("DEBUG: Zum Wendeband fahren\n");
        MP_motor(2, 1);
        MP_impulsscheibe(5);
        MP_p3wait4();
      } else {
        GP_break33();
        MP_motor(2, 2);
        MP_impulsscheibe(6);
        MP_motor(2, 0);
        MP_p3wait5();
      }
    } while (PV_weiss_oben);
  };
}


x86 assembly (clang, -O0):
<MP_prozess3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10c0 <GP_break30@plt>
mov    $0x0,%al
call   1080 <MP_p3wait1@plt>
mov    $0x0,%al
call   10e0 <MP_p3wait2@plt>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x0,%al
call   1040 <GP_break31@plt>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x0,%al
call   1060 <MP_p3wait3@plt>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   10a0 <MP_lichtschranke@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     1299 <MP_prozess3+0xc9>
mov    $0x0,%al
call   10b0 <GP_break32@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   10f0 <MP_motor@plt>
mov    $0x5,%edi
call   1070 <MP_impulsscheibe@plt>
mov    $0x0,%al
call   10d0 <MP_p3wait4@plt>
jmp    12c9 <MP_prozess3+0xf9>
mov    $0x0,%al
call   1030 <GP_break33@plt>
mov    $0x2,%esi
mov    %esi,%edi
call   10f0 <MP_motor@plt>
mov    $0x6,%edi
call   1070 <MP_impulsscheibe@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   10f0 <MP_motor@plt>
mov    $0x0,%al
call   1050 <MP_p3wait5@plt>
jmp    12ce <MP_prozess3+0xfe>
cmpl   $0x0,-0x4(%rbp)
jne    1202 <MP_prozess3+0x32>
jmp    11df <MP_prozess3+0xf>

x86 assembly (clang, -O2):
<MP_prozess3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe28(%rip),%r14
lea    0xe51(%rip),%r15
lea    0xe66(%rip),%r12
lea    0xdf9(%rip),%rbx
lea    0xe99(%rip),%r13
jmp    1241 <MP_prozess3+0x61>
call   1040 <GP_break33@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1100 <MP_motor@plt>
mov    $0x6,%edi
call   1080 <MP_impulsscheibe@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1100 <MP_motor@plt>
xor    %eax,%eax
call   1060 <MP_p3wait5@plt>
xor    %eax,%eax
call   10d0 <GP_break30@plt>
xor    %eax,%eax
call   1090 <MP_p3wait1@plt>
xor    %eax,%eax
call   10f0 <MP_p3wait2@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <GP_break31@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <MP_p3wait3@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <MP_lichtschranke@plt>
mov    %eax,%ebp
xor    %esi,%esi
cmp    $0x1,%eax
sete   %sil
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %eax,%eax
cmp    $0x1,%ebp
jne    1210 <MP_prozess3+0x30>
call   10c0 <GP_break32@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1100 <MP_motor@plt>
mov    $0x5,%edi
call   1080 <MP_impulsscheibe@plt>
xor    %eax,%eax
call   10e0 <MP_p3wait4@plt>
jmp    1260 <MP_prozess3+0x80>

LLVM IR (-O0):
@.str = [49 x i8] c"DEBUG: Paket ist bis zur Lichtschranke gefahren\0A\00"
@.str.1 = [29 x i8] c"DEBUG: Paket zurueck fahren\0A\00"
@.str.2 = [66 x i8] c"DEBUG: Paket ist zurueckgefahren, nun Paketoberflaeche vermessen\0A\00"
@.str.3 = [26 x i8] c"DEBUG: Lichtschranke= %d\0A\00"
@.str.4 = [29 x i8] c"DEBUG: Zum Wendeband fahren\0A\00"
define void @MP_prozess3() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %0, %36
%4 = call i32 (...) @GP_break30()
%5 = call i32 (...) @MP_p3wait1()
%6 = call i32 (...) @MP_p3wait2()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %33, %3
%9 = call i32 (...) @GP_break31()
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (...) @MP_p3wait3()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @MP_lichtschranke(i32 1)
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
store i32 %15, i32* %1
%16 = load i32, i32* %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %1
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %8
%21 = call i32 (...) @GP_break32()
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @MP_motor(i32 2, i32 1)
%24 = call i32 @MP_impulsscheibe(i32 5)
%25 = call i32 (...) @MP_p3wait4()
br label %32
26: ; preds = %8
%27 = call i32 (...) @GP_break33()
%28 = call i32 @MP_motor(i32 2, i32 2)
%29 = call i32 @MP_impulsscheibe(i32 6)
%30 = call i32 @MP_motor(i32 2, i32 0)
%31 = call i32 (...) @MP_p3wait5()
br label %32
32: ; preds = %26, %20
br label %33
33: ; preds = %32
%34 = load i32, i32* %1
%35 = icmp ne i32 %34, 0
br i1 %35, label %8, label %36
36: ; preds = %33
br label %3
}

LLVM IR (-O2):
@.str.3 = [26 x i8] c"DEBUG: Lichtschranke= %d\0A\00"
@str = [48 x i8] c"DEBUG: Paket ist bis zur Lichtschranke gefahren\00"
@str.5 = [28 x i8] c"DEBUG: Paket zurueck fahren\00"
@str.6 = [65 x i8] c"DEBUG: Paket ist zurueckgefahren, nun Paketoberflaeche vermessen\00"
@str.7 = [28 x i8] c"DEBUG: Zum Wendeband fahren\00"
define void @MP_prozess3() {
br label %7
1: ; preds = %20, %7
%2 = tail call i32 (...) @GP_break33()
%3 = tail call i32 @MP_motor(i32 2, i32 2)
%4 = tail call i32 @MP_impulsscheibe(i32 6)
%5 = tail call i32 @MP_motor(i32 2, i32 0)
%6 = tail call i32 (...) @MP_p3wait5()
br label %7
7: ; preds = %1, %0
%8 = tail call i32 (...) @GP_break30()
%9 = tail call i32 (...) @MP_p3wait1()
%10 = tail call i32 (...) @MP_p3wait2()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 (...) @GP_break31()
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%14 = tail call i32 (...) @MP_p3wait3()
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 @MP_lichtschranke(i32 1)
%17 = icmp eq i32 %16, 1
%18 = zext i1 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br i1 %17, label %20, label %1
20: ; preds = %7, %20
%21 = tail call i32 (...) @GP_break32()
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%23 = tail call i32 @MP_motor(i32 2, i32 1)
%24 = tail call i32 @MP_impulsscheibe(i32 5)
%25 = tail call i32 (...) @MP_p3wait4()
%26 = tail call i32 (...) @GP_break31()
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%28 = tail call i32 (...) @MP_p3wait3()
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.6, i64 0, i64 0))
%30 = tail call i32 @MP_lichtschranke(i32 1)
%31 = icmp eq i32 %30, 1
%32 = zext i1 %31 to i32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br i1 %31, label %20, label %1
}