#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 */
typedef int uint32_t;

/* Variables and functions */
int handle_dsform(int, unsigned long *, unsigned long *);
bool extended_57(uint32_t insn, unsigned long *gprs, unsigned long *addr,
                 unsigned long *size) {
  int subopc = (((insn) >> (32 - (30) - (2))) & ((1 << (2)) - 1));
  switch (subopc) {
  case 0:
    *size = 16;
    return handle_dsform(insn, gprs, addr);
  case 2:
    *size = 8;
    return handle_dsform(insn, gprs, addr);
  case 3:
    *size = 4;
    return handle_dsform(insn, gprs, addr);
  }
  return false;
}


x86 assembly (clang, -O0):
<extended_57>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
test   %eax,%eax
je     1165 <extended_57+0x55>
jmp    1143 <extended_57+0x33>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     1188 <extended_57+0x78>
jmp    1154 <extended_57+0x44>
mov    -0x28(%rbp),%eax
sub    $0x3,%eax
je     11ab <extended_57+0x9b>
jmp    11ce <extended_57+0xbe>
mov    -0x20(%rbp),%rax
movq   $0x10,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <handle_dsform@plt>
mov    %eax,-0x4(%rbp)
jmp    11d5 <extended_57+0xc5>
mov    -0x20(%rbp),%rax
movq   $0x8,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <handle_dsform@plt>
mov    %eax,-0x4(%rbp)
jmp    11d5 <extended_57+0xc5>
mov    -0x20(%rbp),%rax
movq   $0x4,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <handle_dsform@plt>
mov    %eax,-0x4(%rbp)
jmp    11d5 <extended_57+0xc5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extended_57>:
mov    %edi,%eax
and    $0x3,%eax
je     112e <extended_57+0x1e>
cmp    $0x3,%eax
je     113b <extended_57+0x2b>
cmp    $0x2,%eax
jne    1148 <extended_57+0x38>
mov    $0x8,%eax
mov    %rax,(%rcx)
jmp    1030 <handle_dsform@plt>
mov    $0x10,%eax
mov    %rax,(%rcx)
jmp    1030 <handle_dsform@plt>
mov    $0x4,%eax
mov    %rax,(%rcx)
jmp    1030 <handle_dsform@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @extended_57(i32 %0, i64* %1, i64* %2, i64* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i64*
%10 = alloca i32
store i32 %0, i32* %6
store i64* %1, i64** %7
store i64* %2, i64** %8
store i64* %3, i64** %9
%11 = load i32, i32* %6
%12 = ashr i32 %11, 0
%13 = and i32 %12, 3
store i32 %13, i32* %10
%14 = load i32, i32* %10
switch i32 %14, label %33 [
i32 0, label %15
i32 2, label %21
i32 3, label %27
]
15: ; preds = %4
%16 = load i64*, i64** %9
store i64 16, i64* %16
%17 = load i32, i32* %6
%18 = load i64*, i64** %7
%19 = load i64*, i64** %8
%20 = call i32 @handle_dsform(i32 %17, i64* %18, i64* %19)
store i32 %20, i32* %5
br label %34
21: ; preds = %4
%22 = load i64*, i64** %9
store i64 8, i64* %22
%23 = load i32, i32* %6
%24 = load i64*, i64** %7
%25 = load i64*, i64** %8
%26 = call i32 @handle_dsform(i32 %23, i64* %24, i64* %25)
store i32 %26, i32* %5
br label %34
27: ; preds = %4
%28 = load i64*, i64** %9
store i64 4, i64* %28
%29 = load i32, i32* %6
%30 = load i64*, i64** %7
%31 = load i64*, i64** %8
%32 = call i32 @handle_dsform(i32 %29, i64* %30, i64* %31)
store i32 %32, i32* %5
br label %34
33: ; preds = %4
store i32 0, i32* %5
br label %34
34: ; preds = %33, %27, %21, %15
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
define i32 @extended_57(i32 %0, i64* %1, i64* %2, i64* nocapture writeonly %3) {
%5 = and i32 %0, 3
switch i32 %5, label %11 [
i32 0, label %8
i32 2, label %6
i32 3, label %7
]
6: ; preds = %4
br label %8
7: ; preds = %4
br label %8
8: ; preds = %4, %6, %7
%9 = phi i64 [ 4, %7 ], [ 8, %6 ], [ 16, %4 ]
store i64 %9, i64* %3
%10 = tail call i32 @handle_dsform(i32 %0, i64* %1, i64* %2)
br label %11
11: ; preds = %8, %4
%12 = phi i32 [ 0, %4 ], [ %10, %8 ]
ret i32 %12
}