read_image_array(file_name, array) char *file_name;
short **array;
{
  int ok = 0;
  if (is_a_tiff(file_name)) {
    read_tiff_image(file_name, array);
    ok = 1;
  }
  if (is_a_bmp(file_name)) {
    read_bmp_image(file_name, array);
    ok = 1;
  }
  if (ok == 0) {
    printf("\nERROR could not read file %s", file_name);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<read_image_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1080 <is_a_tiff@plt>
cmp    $0x0,%eax
je     11a1 <read_image_array+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <read_tiff_image@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <is_a_bmp@plt>
cmp    $0x0,%eax
je     11cb <read_image_array+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <read_bmp_image@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11f1 <read_image_array+0x91>
mov    -0x10(%rbp),%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_image_array>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1080 <is_a_tiff@plt>
mov    %rbx,%rdi
test   %eax,%eax
je     1192 <read_image_array+0x32>
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <read_tiff_image@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <is_a_bmp@plt>
test   %eax,%eax
jne    119d <read_image_array+0x3d>
jmp    11aa <read_image_array+0x4a>
xor    %eax,%eax
call   1060 <is_a_bmp@plt>
test   %eax,%eax
je     11b2 <read_image_array+0x52>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <read_bmp_image@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe47(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\0AERROR could not read file %s\00"
define i32 @read_image_array(i8* %0, i16** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i16**
%6 = alloca i32
store i8* %0, i8** %4
store i16** %1, i16*** %5
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @is_a_tiff to i32 (i8*, ...)*)(i8* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i16**, i16*** %5
%13 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_tiff_image to i32 (i8*, i16**, ...)*)(i8* %11, i16** %12)
store i32 1, i32* %6
br label %14
14: ; preds = %10, %2
%15 = load i8*, i8** %4
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @is_a_bmp to i32 (i8*, ...)*)(i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = load i16**, i16*** %5
%21 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_bmp_image to i32 (i8*, i16**, ...)*)(i8* %19, i16** %20)
store i32 1, i32* %6
br label %22
22: ; preds = %18, %14
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i8*, i8** %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %26)
unreachable
28: ; preds = %22
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0AERROR could not read file %s\00"
define i32 @read_image_array(i8* %0, i16** %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @is_a_tiff to i32 (i8*, ...)*)(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @is_a_bmp to i32 (i8*, ...)*)(i8* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %12
8: ; preds = %2
%9 = tail call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_tiff_image to i32 (i8*, i16**, ...)*)(i8* %0, i16** %1)
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @is_a_bmp to i32 (i8*, ...)*)(i8* %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8, %5
%13 = tail call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_bmp_image to i32 (i8*, i16**, ...)*)(i8* %0, i16** %1)
br label %16
14: ; preds = %5
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
tail call void @exit(i32 1)
unreachable
16: ; preds = %8, %12
ret i32 undef
}