#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 uint8_t;
typedef int int16_t;
typedef int /*<<< orphan*/ block;

/* Variables and functions */
int /*<<< orphan*/ readBlock(int, int, int *);
void readMAG(int *m) {
  uint8_t block[6];
  readBlock(0x80 | 0x08, sizeof(block), block);
  *m = (int16_t)(block[0] | block[1] << 8);
  *(m + 1) = (int16_t)(block[2] | block[3] << 8);
  *(m + 2) = (int16_t)(block[4] | block[5] << 8);
}


x86 assembly (clang, -O0):
<readMAG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdx
mov    $0x88,%edi
mov    $0x18,%esi
call   1030 <readBlock@plt>
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readMAG>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdx
mov    $0x88,%edi
mov    $0x18,%esi
call   1030 <readBlock@plt>
mov    0x4(%rsp),%eax
shl    $0x8,%eax
or     (%rsp),%eax
mov    %eax,(%rbx)
mov    0xc(%rsp),%eax
shl    $0x8,%eax
or     0x8(%rsp),%eax
mov    %eax,0x4(%rbx)
mov    0x14(%rsp),%eax
shl    $0x8,%eax
or     0x10(%rsp),%eax
mov    %eax,0x8(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @readMAG(i32* %0) {
%2 = alloca i32*
%3 = alloca [6 x i32]
store i32* %0, i32** %2
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%5 = call i32 @readBlock(i32 136, i32 24, i32* %4)
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = or i32 %7, %10
%12 = load i32*, i32** %2
store i32 %11, i32* %12
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
%14 = load i32, i32* %13
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 3
%16 = load i32, i32* %15
%17 = shl i32 %16, 8
%18 = or i32 %14, %17
%19 = load i32*, i32** %2
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32 %18, i32* %20
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 4
%22 = load i32, i32* %21
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 5
%24 = load i32, i32* %23
%25 = shl i32 %24, 8
%26 = or i32 %22, %25
%27 = load i32*, i32** %2
%28 = getelementptr inbounds i32, i32* %27, i64 2
store i32 %26, i32* %28
ret void
}

LLVM IR (-O2):
define void @readMAG(i32* nocapture writeonly %0) {
%2 = alloca [6 x i32]
%3 = bitcast [6 x i32]* %2 to i8*
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%5 = call i32 @readBlock(i32 136, i32 24, i32* %4)
%6 = load i32, i32* %4
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %9, %6
store i32 %10, i32* %0
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 3
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = or i32 %15, %12
%17 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %16, i32* %17
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 5
%21 = load i32, i32* %20
%22 = shl i32 %21, 8
%23 = or i32 %22, %19
%24 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %23, i32* %24
ret void
}