#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 */
struct floppy_raw_cmd {
  int *cmd;
  scalar_t__ cmd_count;
  int /*<<< orphan*/ flags;
};

/* Variables and functions */
int /*<<< orphan*/ FDRAWCMD;
int /*<<< orphan*/ FD_RAW_INTR;
int FD_RSEEK_IN;
int /*<<< orphan*/ errno;
int ioctl(int, int /*<<< orphan*/, struct floppy_raw_cmd *);
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int /*<<< orphan*/);
void seekin(int fd) {
  struct floppy_raw_cmd raw_cmd;
  int tmp, i;
  raw_cmd.flags = FD_RAW_INTR;
  raw_cmd.cmd_count = 0;
  raw_cmd.cmd[raw_cmd.cmd_count++] = FD_RSEEK_IN;
  raw_cmd.cmd[raw_cmd.cmd_count++] = 0;
  raw_cmd.cmd[raw_cmd.cmd_count++] = 1;
  tmp = ioctl(fd, FDRAWCMD, &raw_cmd);
  if (tmp)
    printf("seekin nonzero, error = \"%s\"\n", strerror(errno));
}


x86 assembly (clang, -O0):
<seekin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x18(%rbp)
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movl   $0x1,(%rax,%rcx,4)
mov    -0x4(%rbp),%edi
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11e1 <seekin+0xb1>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%struct.floppy_raw_cmd = type { i32*, i64, i32 }
@FD_RAW_INTR = global i32 0
@FD_RSEEK_IN = global i32 0
@FDRAWCMD = global i32 0
@.str = [30 x i8] c"seekin nonzero, error = \22%s\22\0A\00"
@errno = global i32 0
define void @seekin(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.floppy_raw_cmd
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* @FD_RAW_INTR
%7 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 2
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 1
store i64 0, i64* %8
%9 = load i32, i32* @FD_RSEEK_IN
%10 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 0
%11 = load i32*, i32** %10
%12 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 1
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 1
store i64 %14, i64* %12
%15 = getelementptr inbounds i32, i32* %11, i64 %13
store i32 %9, i32* %15
%16 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 0
%17 = load i32*, i32** %16
%18 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 1
%19 = load i64, i64* %18
%20 = add nsw i64 %19, 1
store i64 %20, i64* %18
%21 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 0, i32* %21
%22 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 0
%23 = load i32*, i32** %22
%24 = getelementptr inbounds %struct.floppy_raw_cmd, %struct.floppy_raw_cmd* %3, i32 0, i32 1
%25 = load i64, i64* %24
%26 = add nsw i64 %25, 1
store i64 %26, i64* %24
%27 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 1, i32* %27
%28 = load i32, i32* %2
%29 = load i32, i32* @FDRAWCMD
%30 = call i32 @ioctl(i32 %28, i32 %29, %struct.floppy_raw_cmd* %3)
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %1
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %33, %1
ret void
}

LLVM IR (-O2):