#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 e(char *);
scalar_t__ stbi_gif_info_from_file(int /*<<< orphan*/ *, int *, int *, int *);
scalar_t__ stbi_jpeg_info_from_file(int /*<<< orphan*/ *, int *, int *, int *);
scalar_t__ stbi_png_info_from_file(int /*<<< orphan*/ *, int *, int *, int *);
scalar_t__ stbi_tga_info_from_file(int /*<<< orphan*/ *, int *, int *, int *);
int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) {
  if (stbi_jpeg_info_from_file(f, x, y, comp))
    return 1;
  if (stbi_png_info_from_file(f, x, y, comp))
    return 1;
  if (stbi_gif_info_from_file(f, x, y, comp))
    return 1;
  if (stbi_tga_info_from_file(f, x, y, comp))
    return 1;
  return e("unknown image type");
}


x86 assembly (clang, -O0):
<stbi_info_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <stbi_jpeg_info_from_file@plt>
cmp    $0x0,%rax
je     1193 <stbi_info_from_file+0x43>
movl   $0x1,-0x4(%rbp)
jmp    1223 <stbi_info_from_file+0xd3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1060 <stbi_png_info_from_file@plt>
cmp    $0x0,%rax
je     11be <stbi_info_from_file+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1223 <stbi_info_from_file+0xd3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1070 <stbi_gif_info_from_file@plt>
cmp    $0x0,%rax
je     11e9 <stbi_info_from_file+0x99>
movl   $0x1,-0x4(%rbp)
jmp    1223 <stbi_info_from_file+0xd3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <stbi_tga_info_from_file@plt>
cmp    $0x0,%rax
je     1214 <stbi_info_from_file+0xc4>
movl   $0x1,-0x4(%rbp)
jmp    1223 <stbi_info_from_file+0xd3>
lea    0xde5(%rip),%rdi
call   1050 <e@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stbi_info_from_file>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1040 <stbi_jpeg_info_from_file@plt>
test   %rax,%rax
jne    11b0 <stbi_info_from_file+0x60>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1060 <stbi_png_info_from_file@plt>
test   %rax,%rax
jne    11b0 <stbi_info_from_file+0x60>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1070 <stbi_gif_info_from_file@plt>
test   %rax,%rax
jne    11b0 <stbi_info_from_file+0x60>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <stbi_tga_info_from_file@plt>
test   %rax,%rax
je     11c1 <stbi_info_from_file+0x71>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe38(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <e@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"unknown image type\00"
define i32 @stbi_info_from_file(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%10 = load i32*, i32** %6
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = load i32*, i32** %9
%14 = call i64 @stbi_jpeg_info_from_file(i32* %10, i32* %11, i32* %12, i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 1, i32* %5
br label %43
17: ; preds = %4
%18 = load i32*, i32** %6
%19 = load i32*, i32** %7
%20 = load i32*, i32** %8
%21 = load i32*, i32** %9
%22 = call i64 @stbi_png_info_from_file(i32* %18, i32* %19, i32* %20, i32* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %17
store i32 1, i32* %5
br label %43
25: ; preds = %17
%26 = load i32*, i32** %6
%27 = load i32*, i32** %7
%28 = load i32*, i32** %8
%29 = load i32*, i32** %9
%30 = call i64 @stbi_gif_info_from_file(i32* %26, i32* %27, i32* %28, i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %25
store i32 1, i32* %5
br label %43
33: ; preds = %25
%34 = load i32*, i32** %6
%35 = load i32*, i32** %7
%36 = load i32*, i32** %8
%37 = load i32*, i32** %9
%38 = call i64 @stbi_tga_info_from_file(i32* %34, i32* %35, i32* %36, i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %33
store i32 1, i32* %5
br label %43
41: ; preds = %33
%42 = call i32 @e(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 %42, i32* %5
br label %43
43: ; preds = %41, %40, %32, %24, %16
%44 = load i32, i32* %5
ret i32 %44
}

LLVM IR (-O2):
@.str = [19 x i8] c"unknown image type\00"
define i32 @stbi_info_from_file(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = tail call i64 @stbi_jpeg_info_from_file(i32* %0, i32* %1, i32* %2, i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = tail call i64 @stbi_png_info_from_file(i32* %0, i32* %1, i32* %2, i32* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = tail call i64 @stbi_gif_info_from_file(i32* %0, i32* %1, i32* %2, i32* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = tail call i64 @stbi_tga_info_from_file(i32* %0, i32* %1, i32* %2, i32* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @e(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %13, %10, %7, %4, %16
%19 = phi i32 [ %17, %16 ], [ 1, %4 ], [ 1, %7 ], [ 1, %10 ], [ 1, %13 ]
ret i32 %19
}