#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 */
scalar_t__ run_oracle_valid(char *, int, unsigned char *, unsigned int);
int run_oracle_valid_multiple(char *hostport, unsigned char *encrypted_key,
                              unsigned int encrypted_key_length) {
  if (run_oracle_valid(hostport, 24, encrypted_key, encrypted_key_length))
    return 24;
  if (run_oracle_valid(hostport, 16, encrypted_key, encrypted_key_length))
    return 16;
  if (run_oracle_valid(hostport, 8, encrypted_key, encrypted_key_length))
    return 8;
  return 0;
}


x86 assembly (clang, -O0):
<run_oracle_valid_multiple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x18,%esi
call   1030 <run_oracle_valid@plt>
cmp    $0x0,%rax
je     114e <run_oracle_valid_multiple+0x3e>
movl   $0x18,-0x4(%rbp)
jmp    11ab <run_oracle_valid_multiple+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x10,%esi
call   1030 <run_oracle_valid@plt>
cmp    $0x0,%rax
je     1179 <run_oracle_valid_multiple+0x69>
movl   $0x10,-0x4(%rbp)
jmp    11ab <run_oracle_valid_multiple+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x8,%esi
call   1030 <run_oracle_valid@plt>
cmp    $0x0,%rax
je     11a4 <run_oracle_valid_multiple+0x94>
movl   $0x8,-0x4(%rbp)
jmp    11ab <run_oracle_valid_multiple+0x9b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_oracle_valid_multiple>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x18,%ebp
mov    $0x18,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <run_oracle_valid@plt>
test   %rax,%rax
jne    1176 <run_oracle_valid_multiple+0x66>
mov    $0x10,%ebp
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <run_oracle_valid@plt>
test   %rax,%rax
jne    1176 <run_oracle_valid_multiple+0x66>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1030 <run_oracle_valid@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
shl    $0x3,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @run_oracle_valid_multiple(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = load i32, i32* %7
%11 = call i64 @run_oracle_valid(i8* %8, i32 24, i8* %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 24, i32* %4
br label %29
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = call i64 @run_oracle_valid(i8* %15, i32 16, i8* %16, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 16, i32* %4
br label %29
21: ; preds = %14
%22 = load i8*, i8** %5
%23 = load i8*, i8** %6
%24 = load i32, i32* %7
%25 = call i64 @run_oracle_valid(i8* %22, i32 8, i8* %23, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 8, i32* %4
br label %29
28: ; preds = %21
store i32 0, i32* %4
br label %29
29: ; preds = %28, %27, %20, %13
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @run_oracle_valid_multiple(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @run_oracle_valid(i8* %0, i32 24, i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = tail call i64 @run_oracle_valid(i8* %0, i32 16, i8* %1, i32 %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i64 @run_oracle_valid(i8* %0, i32 8, i8* %1, i32 %2)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i32 0, i32 8
br label %13
13: ; preds = %9, %6, %3
%14 = phi i32 [ 24, %3 ], [ 16, %6 ], [ %12, %9 ]
ret i32 %14
}