#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int, int);
void get_tape_name(char *tape_name, FILE *infile) {
  if (fseek(infile, 40, SEEK_SET) != 0 || fread(tape_name, 24, 1, infile) < 1)
    memset(tape_name, 0x20, 24);
  tape_name[24] = 0;
}


x86 assembly (clang, -O0):
<get_tape_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
mov    $0x28,%esi
call   1050 <fseek@plt>
cmp    $0x0,%rax
jne    1181 <get_tape_name+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x18,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jge    1194 <get_tape_name+0x64>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
movb   $0x0,0x18(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tape_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
mov    %rsi,%rdi
mov    $0x28,%esi
call   1050 <fseek@plt>
test   %rax,%rax
jne    116e <get_tape_name+0x3e>
mov    %r14,%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
test   %eax,%eax
jg     1180 <get_tape_name+0x50>
mov    %r14,%rdi
mov    $0x20,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
movb   $0x0,0x18(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @get_tape_name(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i32, i32* @SEEK_SET
%7 = call i64 @fseek(i32* %5, i32 40, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i32*, i32** %4
%12 = call i32 @fread(i8* %10, i32 24, i32 1, i32* %11)
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %9, %2
%15 = load i8*, i8** %3
%16 = call i32 @memset(i8* %15, i32 32, i32 24)
br label %17
17: ; preds = %14, %9
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 24
store i8 0, i8* %19
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @get_tape_name(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* @SEEK_SET
%4 = tail call i64 @fseek(i32* %1, i32 40, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @fread(i8* %0, i32 24, i32 1, i32* %1)
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %6, %2
%10 = tail call i32 @memset(i8* %0, i32 32, i32 24)
br label %11
11: ; preds = %9, %6
%12 = getelementptr inbounds i8, i8* %0, i64 24
store i8 0, i8* %12
ret void
}