#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, int *, int *,
           int *, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int);
int main() {
  FILE *ifp = fopen("data.txt", "r");
  int gx, gy, gz, mx, my, mz, grp;
  while (fscanf(ifp, "%d %d %d %d %d %d %d", &gx, &mx, &gy, &my, &gz, &mz,
                &grp) == 7) {
    printf("0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x %d\n", gx, gy, gz, mx, my,
           mz, grp);
  }
  fclose(ifp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x18(%rbp),%r8
lea    -0x24(%rbp),%r9
lea    -0x1c(%rbp),%r11
lea    -0x28(%rbp),%r10
lea    -0x2c(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <fscanf@plt>
cmp    $0x7,%eax
jne    11da <main+0x9a>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%r10d
mov    -0x2c(%rbp),%eax
lea    0xe58(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <printf@plt>
jmp    1166 <main+0x26>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rdi
lea    0xead(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
sub    $0x8,%rsp
lea    0x28(%rsp),%rbp
lea    0x2c(%rsp),%rbx
lea    0x1c(%rsp),%rax
lea    0xe8d(%rip),%rsi
lea    0x24(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x14(%rsp),%r9
mov    %r12,%rdi
push   %rbp
push   %rbx
push   %rax
call   1050 <fscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    122c <main+0xec>
lea    0x10(%rsp),%r13
lea    0x18(%rsp),%r15
lea    0xc(%rsp),%r14
nopl   0x0(%rax)
mov    0x1c(%rsp),%esi
mov    0x18(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%r8d
mov    0xc(%rsp),%r9d
mov    0x24(%rsp),%r10d
mov    %rbx,%rax
mov    %rbp,%rbx
mov    0x20(%rsp),%ebp
lea    0xe34(%rip),%rdi
push   %rbp
mov    %rbx,%rbp
mov    %rax,%rbx
push   %r10
call   1040 <printf@plt>
add    $0x8,%rsp
mov    %r12,%rdi
lea    0xe03(%rip),%rsi
lea    0x24(%rsp),%rdx
mov    %r13,%rcx
mov    %r15,%r8
mov    %r14,%r9
push   %rbp
push   %rbx
lea    0x2c(%rsp),%rax
push   %rax
call   1050 <fscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
je     11c0 <main+0x80>
mov    %r12,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"data.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"%d %d %d %d %d %d %d\00"
@.str.3 = [46 x i8] c"0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
br label %11
11: ; preds = %15, %0
%12 = load i32*, i32** %2
%13 = call i32 @fscanf(i32* %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %6, i32* %4, i32* %7, i32* %5, i32* %8, i32* %9)
%14 = icmp eq i32 %13, 7
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %17, i32 %18, i32 %19, i32 %20, i32 %21, i32 %22)
br label %11
24: ; preds = %11
%25 = load i32*, i32** %2
%26 = call i32 @fclose(i32* %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"data.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"%d %d %d %d %d %d %d\00"
@.str.3 = [46 x i8] c"0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = bitcast i32* %1 to i8*
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %4, i32* %2, i32* %5, i32* %3, i32* %6, i32* %7)
%17 = icmp eq i32 %16, 7
br i1 %17, label %18, label %29
18: ; preds = %0, %18
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %20, i32 %21, i32 %22, i32 %23, i32 %24, i32 %25)
%27 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %4, i32* %2, i32* %5, i32* %3, i32* %6, i32* %7)
%28 = icmp eq i32 %27, 7
br i1 %28, label %18, label %29
29: ; preds = %18, %0
%30 = call i32 @fclose(i32* %8)
ret i32 0
}