#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*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void LogFileFormat(FILE *fp, char *key, signed char fileformat) {
  if (fileformat == 1) {
    fprintf(fp, "%s  COMPLEX_DATA\n", key);
  } else if (fileformat == 2) {
    fprintf(fp, "%s  FLOAT_DATA\n", key);
  } else if (fileformat == 3) {
    fprintf(fp, "%s  ALT_LINE_DATA\n", key);
  } else if (fileformat == 4) {
    fprintf(fp, "%s  ALT_SAMPLE_DATA\n", key);
  }
}


x86 assembly (clang, -O0):
<LogFileFormat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x1,%eax
jne    114b <LogFileFormat+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c7 <LogFileFormat+0xb7>
movsbl -0x11(%rbp),%eax
cmp    $0x2,%eax
jne    1171 <LogFileFormat+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeab(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c2 <LogFileFormat+0xb2>
movsbl -0x11(%rbp),%eax
cmp    $0x3,%eax
jne    1197 <LogFileFormat+0x87>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe95(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11bd <LogFileFormat+0xad>
movsbl -0x11(%rbp),%eax
cmp    $0x4,%eax
jne    11b8 <LogFileFormat+0xa8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe82(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11bd <LogFileFormat+0xad>
jmp    11c2 <LogFileFormat+0xb2>
jmp    11c7 <LogFileFormat+0xb7>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogFileFormat>:
add    $0xff,%dl
cmp    $0x3,%dl
ja     1135 <LogFileFormat+0x25>
mov    %rsi,%rax
movsbq %dl,%rcx
lea    0xf26(%rip),%rdx
movslq (%rdx,%rcx,4),%rsi
add    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%s COMPLEX_DATA\0A\00"
@.str.1 = [16 x i8] c"%s FLOAT_DATA\0A\00"
@.str.2 = [19 x i8] c"%s ALT_LINE_DATA\0A\00"
@.str.3 = [21 x i8] c"%s ALT_SAMPLE_DATA\0A\00"
define void @LogFileFormat(i32* %0, i8* %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i8*, i8** %5
%13 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %41
14: ; preds = %3
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32*, i32** %4
%20 = load i8*, i8** %5
%21 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %40
22: ; preds = %14
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 3
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i32*, i32** %4
%28 = load i8*, i8** %5
%29 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %28)
br label %39
30: ; preds = %22
%31 = load i8, i8* %6
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 4
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32*, i32** %4
%36 = load i8*, i8** %5
%37 = call i32 @fprintf(i32* %35, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %34, %30
br label %39
39: ; preds = %38, %26
br label %40
40: ; preds = %39, %18
br label %41
41: ; preds = %40, %10
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s COMPLEX_DATA\0A\00"
@.str.1 = [16 x i8] c"%s FLOAT_DATA\0A\00"
@.str.2 = [19 x i8] c"%s ALT_LINE_DATA\0A\00"
@.str.3 = [21 x i8] c"%s ALT_SAMPLE_DATA\0A\00"
@reltable.LogFileFormat = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.LogFileFormat to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.LogFileFormat to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.LogFileFormat to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.LogFileFormat to i64)) to i32)]
define void @LogFileFormat(i32* nocapture %0, i8* %1, i8 signext %2) {
%4 = add i8 %2, -1
%5 = icmp ult i8 %4, 4
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = sext i8 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.LogFileFormat to i8*), i64 %8)
%10 = tail call i32 @fprintf(i32* %0, i8* %9, i8* %1)
br label %11
11: ; preds = %3, %6
ret void
}