#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 setsize(unsigned long, unsigned int *, unsigned int *, unsigned int *);
void setsize0(unsigned long capacity, unsigned int *cyls, unsigned int *hds,
              unsigned int *secs) {
  int r;
  if (capacity < 1024 * 2048 && !(capacity % 1024)) {
    *cyls = capacity >> 11;
    *hds = 64;
    *secs = 32;
    return;
  }
  r = setsize(capacity, cyls, hds, secs);
  if (r || *hds > 255 || *secs > 63) {
    *cyls = capacity >> 11;
    *hds = 64;
    *secs = 32;
    return;
  }
}


x86 assembly (clang, -O0):
<setsize0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x200000,-0x8(%rbp)
jae    1173 <setsize0+0x63>
mov    -0x8(%rbp),%rax
and    $0x3ff,%rax
cmp    $0x0,%rax
jne    1173 <setsize0+0x63>
mov    -0x8(%rbp),%rax
shr    $0xb,%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x40,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x20,(%rax)
jmp    11d6 <setsize0+0xc6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <setsize@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11b2 <setsize0+0xa2>
mov    -0x18(%rbp),%rax
cmpl   $0xff,(%rax)
ja     11b2 <setsize0+0xa2>
mov    -0x20(%rbp),%rax
cmpl   $0x3f,(%rax)
jbe    11d6 <setsize0+0xc6>
mov    -0x8(%rbp),%rax
shr    $0xb,%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x40,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x20,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setsize0>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
test   $0xffffffffffe003ff,%rdi
je     1152 <setsize0+0x42>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
call   1030 <setsize@plt>
test   %eax,%eax
jne    1152 <setsize0+0x42>
cmpl   $0xff,(%r12)
ja     1152 <setsize0+0x42>
cmpl   $0x40,(%r14)
jb     1168 <setsize0+0x58>
shr    $0xb,%rbx
mov    %ebx,(%r15)
movl   $0x40,(%r12)
movl   $0x20,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @setsize0(i64 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i64 %0, i64* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i64, i64* %5
%11 = icmp ult i64 %10, 2097152
br i1 %11, label %12, label %23
12: ; preds = %4
%13 = load i64, i64* %5
%14 = urem i64 %13, 1024
%15 = icmp ne i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %12
%17 = load i64, i64* %5
%18 = lshr i64 %17, 11
%19 = trunc i64 %18 to i32
%20 = load i32*, i32** %6
store i32 %19, i32* %20
%21 = load i32*, i32** %7
store i32 64, i32* %21
%22 = load i32*, i32** %8
store i32 32, i32* %22
br label %46
23: ; preds = %12, %4
%24 = load i64, i64* %5
%25 = load i32*, i32** %6
%26 = load i32*, i32** %7
%27 = load i32*, i32** %8
%28 = call i32 @setsize(i64 %24, i32* %25, i32* %26, i32* %27)
store i32 %28, i32* %9
%29 = load i32, i32* %9
%30 = icmp ne i32 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %23
%32 = load i32*, i32** %7
%33 = load i32, i32* %32
%34 = icmp ugt i32 %33, 255
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i32*, i32** %8
%37 = load i32, i32* %36
%38 = icmp ugt i32 %37, 63
br i1 %38, label %39, label %46
39: ; preds = %35, %31, %23
%40 = load i64, i64* %5
%41 = lshr i64 %40, 11
%42 = trunc i64 %41 to i32
%43 = load i32*, i32** %6
store i32 %42, i32* %43
%44 = load i32*, i32** %7
store i32 64, i32* %44
%45 = load i32*, i32** %8
store i32 32, i32* %45
br label %46
46: ; preds = %16, %39, %35
ret void
}

LLVM IR (-O2):
define void @setsize0(i64 %0, i32* %1, i32* %2, i32* %3) {
%5 = and i64 %0, -2096129
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %4
%8 = tail call i32 @setsize(i64 %0, i32* %1, i32* %2, i32* %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp ugt i32 %11, 255
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp ugt i32 %14, 63
br i1 %15, label %16, label %19
16: ; preds = %7, %10, %13, %4
%17 = lshr i64 %0, 11
%18 = trunc i64 %17 to i32
store i32 %18, i32* %1
store i32 64, i32* %2
store i32 32, i32* %3
br label %19
19: ; preds = %16, %13
ret void
}