#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 sclp_service_call(unsigned int, void *);
int /*<<< orphan*/ sclp_wait_for_int(int /*<<< orphan*/);
int start_sclp(unsigned int cmd, void *sccb) {
  int rc;
  while (1) {
    rc = sclp_service_call(cmd, sccb);
    if (rc == 3)
      return 1;
    if (rc == 2)
      sclp_wait_for_int(0);
    else
      break;
  }
  sclp_wait_for_int(0);
  return 0;
}


x86 assembly (clang, -O0):
<start_sclp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <sclp_service_call@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jne    1154 <start_sclp+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1182 <start_sclp+0x62>
cmpl   $0x2,-0x14(%rbp)
jne    116a <start_sclp+0x4a>
xor    %edi,%edi
call   1040 <sclp_wait_for_int@plt>
jmp    116f <start_sclp+0x4f>
jmp    1174 <start_sclp+0x54>
jmp    112f <start_sclp+0xf>
xor    %edi,%edi
call   1040 <sclp_wait_for_int@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_sclp>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <sclp_service_call@plt>
cmp    $0x2,%eax
jne    1148 <start_sclp+0x28>
xor    %edi,%edi
call   1040 <sclp_wait_for_int@plt>
jmp    1130 <start_sclp+0x10>
cmp    $0x3,%eax
jne    1154 <start_sclp+0x34>
mov    $0x1,%ebx
jmp    115d <start_sclp+0x3d>
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <sclp_wait_for_int@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @start_sclp(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
br label %7
7: ; preds = %2, %20
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = call i32 @sclp_service_call(i32 %8, i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %14
13: ; preds = %7
store i32 1, i32* %3
br label %23
14: ; preds = %7
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @sclp_wait_for_int(i32 0)
br label %20
19: ; preds = %14
br label %21
20: ; preds = %17
br label %7
21: ; preds = %19
%22 = call i32 @sclp_wait_for_int(i32 0)
store i32 0, i32* %3
br label %23
23: ; preds = %21, %13
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @start_sclp(i32 %0, i8* %1) {
br label %3
3: ; preds = %5, %2
%4 = tail call i32 @sclp_service_call(i32 %0, i8* %1)
switch i32 %4, label %7 [
i32 3, label %9
i32 2, label %5
]
5: ; preds = %3
%6 = tail call i32 @sclp_wait_for_int(i32 0)
br label %3
7: ; preds = %3
%8 = tail call i32 @sclp_wait_for_int(i32 0)
br label %9
9: ; preds = %3, %7
%10 = phi i32 [ 0, %7 ], [ 1, %3 ]
ret i32 %10
}