#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*/ do_block(void *, size_t, size_t, size_t, size_t, int, int);
int /*<<< orphan*/ do_list(int /*<<< orphan*/);
void *read_from_fp(int /*<<< orphan*/, size_t *, size_t *);
int /*<<< orphan*/ stdin;
void input_from_stdin(size_t offset, size_t fp_len, int action, int options) {
  size_t len, buf_len;
  if (action == 2) {
    do_list(0);
  } else {
    void *data = read_from_fp(stdin, &len, &buf_len);
    do_block(data, len, buf_len, offset, fp_len, action, options);
  }
}


x86 assembly (clang, -O0):
<input_from_stdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x2,-0x14(%rbp)
jne    115c <input_from_stdin+0x2c>
xor    %edi,%edi
call   1040 <do_list@plt>
jmp    1199 <input_from_stdin+0x69>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <read_from_fp@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <do_block@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_from_stdin>:
cmp    $0x2,%edx
jne    113c <input_from_stdin+0xc>
xor    %edi,%edi
jmp    1040 <do_list@plt>
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <read_from_fp@plt>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %ebp,(%rsp)
mov    %rax,%rdi
mov    %r15,%rcx
mov    %r14,%r8
mov    %ebx,%r9d
call   1030 <do_block@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
define void @input_from_stdin(i64 %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i64* %5 to i8*
%8 = bitcast i64* %6 to i8*
%9 = icmp eq i32 %2, 2
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @do_list(i32 0)
br label %18
12: ; preds = %4
%13 = load i32, i32* @stdin
%14 = call i8* @read_from_fp(i32 %13, i64* %5, i64* %6)
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = call i32 @do_block(i8* %14, i64 %15, i64 %16, i64 %0, i64 %1, i32 %2, i32 %3)
br label %18
18: ; preds = %12, %10
ret void
}