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

/* Variables and functions */
int /*<<< orphan*/ gzgets(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ gzscanf(int /*<<< orphan*/ *, char *, char *, ...);
int read_header(gzFile *in, int *dim_x, int *dim_y, int *dim_z, float *x0,
                float *y0, float *z0, float *dx, float *dy, float *dz,
                int *num_data) {
  char s[100];
  float tmp;
  int tmp1;
  gzgets(in, s, 100);
  gzgets(in, s, 100);
  gzgets(in, s, 100);
  gzgets(in, s, 100);
  gzscanf(in, "%6s %1s %5s %13s %6s %i %i %i \n", s, s, s, s, s, dim_x, dim_y,
          dim_z);
  gzscanf(in, "%6s %f %f %f \n", s, x0, y0, z0);
  gzscanf(in, "%5s %f %f %f \n", s, dx, &tmp, &tmp);
  gzscanf(in, "%5s %f %f %f \n", s, &tmp, dy, &tmp);
  gzscanf(in, "%5s %f %f %f \n", s, &tmp, &tmp, dz);
  gzgets(in, s, 100);
  gzscanf(in, "%6s %i %5s %5s %4s %6s %4s %i %5s %i %4s %7s \n", s, &tmp1, s, s,
          s, s, s, &tmp1, s, num_data, s, s);
  return *num_data;
}


x86 assembly (clang, -O0):
<read_header>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    -0xc0(%rbp),%r8
lea    -0xc0(%rbp),%r9
lea    -0xc0(%rbp),%rbx
mov    -0x38(%rbp),%r11
mov    -0x40(%rbp),%r10
mov    -0x48(%rbp),%rax
lea    0xe12(%rip),%rsi
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1040 <gzscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    0x10(%rbp),%r9
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1040 <gzscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
mov    0x18(%rbp),%rcx
lea    0xdec(%rip),%rsi
lea    -0xc4(%rbp),%r9
mov    %r9,%r8
mov    $0x0,%al
call   1040 <gzscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
mov    0x20(%rbp),%r8
lea    0xdc5(%rip),%rsi
lea    -0xc4(%rbp),%r9
mov    %r9,%rcx
mov    $0x0,%al
call   1040 <gzscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
mov    0x28(%rbp),%r9
lea    0xd9e(%rip),%rsi
lea    -0xc4(%rbp),%r8
mov    %r8,%rcx
mov    $0x0,%al
call   1040 <gzscanf@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rdx
lea    -0xc0(%rbp),%r8
lea    -0xc0(%rbp),%r9
lea    -0xc0(%rbp),%r13
lea    -0xc0(%rbp),%r12
lea    -0xc0(%rbp),%r15
lea    -0xc0(%rbp),%rbx
mov    0x30(%rbp),%r11
lea    -0xc0(%rbp),%r10
lea    -0xc0(%rbp),%rax
lea    0xd39(%rip),%rsi
lea    -0xc8(%rbp),%r14
mov    %r14,%rcx
mov    %r13,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
mov    $0x0,%al
call   1040 <gzscanf@plt>
mov    0x30(%rbp),%rax
mov    (%rax),%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_header>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,(%rsp)
mov    %r8,%r15
mov    %rcx,%rbp
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
lea    0x10(%rsp),%r14
mov    %r14,%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%rcx
mov    %r14,%r8
mov    %r14,%r9
xor    %eax,%eax
push   %rbp
push   %r12
push   %r13
push   %r14
call   1040 <gzscanf@plt>
add    $0x20,%rsp
lea    0xe6e(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
mov    (%rsp),%r8
mov    0xb0(%rsp),%r9
xor    %eax,%eax
call   1040 <gzscanf@plt>
lea    0xe5a(%rip),%r15
lea    0xc(%rsp),%rbp
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    0xb8(%rsp),%rcx
mov    %rbp,%r8
mov    %rbp,%r9
xor    %eax,%eax
call   1040 <gzscanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    0xc0(%rsp),%r8
mov    %rbp,%r9
xor    %eax,%eax
call   1040 <gzscanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %rbp,%r8
mov    0xc8(%rsp),%r9
xor    %eax,%eax
call   1040 <gzscanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1030 <gzgets@plt>
lea    0x8(%rsp),%rcx
lea    0xdee(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%r8
mov    %r14,%r9
xor    %eax,%eax
push   %r14
push   %r14
mov    0xe0(%rsp),%rbx
push   %rbx
push   %r14
push   %rcx
push   %r14
push   %r14
push   %r14
call   1040 <gzscanf@plt>
add    $0x40,%rsp
mov    (%rbx),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"%6s %1s %5s %13s %6s %i %i %i \0A\00"
@.str.1 = [15 x i8] c"%6s %f %f %f \0A\00"
@.str.2 = [15 x i8] c"%5s %f %f %f \0A\00"
@.str.3 = [47 x i8] c"%6s %i %5s %5s %4s %6s %4s %i %5s %i %4s %7s \0A\00"
define i32 @read_header(i32* %0, i32* %1, i32* %2, i32* %3, float* %4, float* %5, float* %6, float* %7, float* %8, float* %9, i32* %10) {
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca float*
%17 = alloca float*
%18 = alloca float*
%19 = alloca float*
%20 = alloca float*
%21 = alloca float*
%22 = alloca i32*
%23 = alloca [100 x i8]
%24 = alloca float
%25 = alloca i32
store i32* %0, i32** %12
store i32* %1, i32** %13
store i32* %2, i32** %14
store i32* %3, i32** %15
store float* %4, float** %16
store float* %5, float** %17
store float* %6, float** %18
store float* %7, float** %19
store float* %8, float** %20
store float* %9, float** %21
store i32* %10, i32** %22
%26 = load i32*, i32** %12
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%28 = call i32 @gzgets(i32* %26, i8* %27, i32 100)
%29 = load i32*, i32** %12
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%31 = call i32 @gzgets(i32* %29, i8* %30, i32 100)
%32 = load i32*, i32** %12
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%34 = call i32 @gzgets(i32* %32, i8* %33, i32 100)
%35 = load i32*, i32** %12
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%37 = call i32 @gzgets(i32* %35, i8* %36, i32 100)
%38 = load i32*, i32** %12
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%44 = load i32*, i32** %13
%45 = load i32*, i32** %14
%46 = load i32*, i32** %15
%47 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %38, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %39, i8* %40, i8* %41, i8* %42, i8* %43, i32* %44, i32* %45, i32* %46)
%48 = load i32*, i32** %12
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%50 = load float*, float** %16
%51 = load float*, float** %17
%52 = load float*, float** %18
%53 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %48, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %49, float* %50, float* %51, float* %52)
%54 = load i32*, i32** %12
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%56 = load float*, float** %19
%57 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %54, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %55, float* %56, float* %24, float* %24)
%58 = load i32*, i32** %12
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%60 = load float*, float** %20
%61 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %58, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %59, float* %24, float* %60, float* %24)
%62 = load i32*, i32** %12
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%64 = load float*, float** %21
%65 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %62, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %63, float* %24, float* %24, float* %64)
%66 = load i32*, i32** %12
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%68 = call i32 @gzgets(i32* %66, i8* %67, i32 100)
%69 = load i32*, i32** %12
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%73 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%77 = load i32*, i32** %22
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %23, i64 0, i64 0
%80 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %69, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %70, i32* %25, i8* %71, i8* %72, i8* %73, i8* %74, i8* %75, i32* %25, i8* %76, i32* %77, i8* %78, i8* %79)
%81 = load i32*, i32** %22
%82 = load i32, i32* %81
ret i32 %82
}

LLVM IR (-O2):
@.str = [32 x i8] c"%6s %1s %5s %13s %6s %i %i %i \0A\00"
@.str.1 = [15 x i8] c"%6s %f %f %f \0A\00"
@.str.2 = [15 x i8] c"%5s %f %f %f \0A\00"
@.str.3 = [47 x i8] c"%6s %i %5s %5s %4s %6s %4s %i %5s %i %4s %7s \0A\00"
define i32 @read_header(i32* %0, i32* %1, i32* %2, i32* %3, float* %4, float* %5, float* %6, float* %7, float* %8, float* %9, i32* %10) {
%12 = alloca [100 x i8]
%13 = alloca float
%14 = alloca i32
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%16 = bitcast float* %13 to i8*
%17 = bitcast i32* %14 to i8*
%18 = call i32 @gzgets(i32* %0, i8* %15, i32 100)
%19 = call i32 @gzgets(i32* %0, i8* %15, i32 100)
%20 = call i32 @gzgets(i32* %0, i8* %15, i32 100)
%21 = call i32 @gzgets(i32* %0, i8* %15, i32 100)
%22 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %15, i8* %15, i8* %15, i8* %15, i32* %1, i32* %2, i32* %3)
%23 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %15, float* %4, float* %5, float* %6)
%24 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %15, float* %7, float* %13, float* %13)
%25 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %15, float* %13, float* %8, float* %13)
%26 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %15, float* %13, float* %13, float* %9)
%27 = call i32 @gzgets(i32* %0, i8* %15, i32 100)
%28 = call i32 (i32*, i8*, i8*, ...) @gzscanf(i32* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %15, i32* %14, i8* %15, i8* %15, i8* %15, i8* %15, i8* %15, i32* %14, i8* %15, i32* %10, i8* %15, i8* %15)
%29 = load i32, i32* %10
ret i32 %29
}