#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 /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  FILE *p, *pp;
  int c;
  char d[4];
  p = fopen("logo_arduino.bmp", "rb");
  for (int x = 1; x <= 4; x++) {
    fseek(p, 6 - x, 0);
    c = getc(p);
    d[x - 1] = c;
    printf("%d ", d[x - 1]);
  }
  fclose(p);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jg     11e0 <main+0x90>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
sub    -0x24(%rbp),%esi
xor    %edx,%edx
call   1050 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x20(%rbp,%rax,1),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117d <main+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1080 <getc@plt>
movsbl %al,%esi
lea    0xe79(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1080 <getc@plt>
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1080 <getc@plt>
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1080 <getc@plt>
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"logo_arduino.bmp\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [4 x i8]
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
store i32 1, i32* %6
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %6
%10 = icmp sle i32 %9, 4
br i1 %10, label %11, label %34
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = load i32, i32* %6
%14 = sub nsw i32 6, %13
%15 = call i32 @fseek(i32* %12, i32 %14, i32 0)
%16 = load i32*, i32** %2
%17 = call i32 @getc(i32* %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = trunc i32 %18 to i8
%20 = load i32, i32* %6
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %22
store i8 %19, i8* %23
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %11
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %8
34: ; preds = %8
%35 = load i32*, i32** %2
%36 = call i32 @fclose(i32* %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"logo_arduino.bmp\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @fseek(i32* %1, i32 5, i32 0)
%3 = tail call i32 @getc(i32* %1)
%4 = shl i32 %3, 24
%5 = ashr exact i32 %4, 24
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @fseek(i32* %1, i32 4, i32 0)
%8 = tail call i32 @getc(i32* %1)
%9 = shl i32 %8, 24
%10 = ashr exact i32 %9, 24
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = tail call i32 @fseek(i32* %1, i32 3, i32 0)
%13 = tail call i32 @getc(i32* %1)
%14 = shl i32 %13, 24
%15 = ashr exact i32 %14, 24
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = tail call i32 @fseek(i32* %1, i32 2, i32 0)
%18 = tail call i32 @getc(i32* %1)
%19 = shl i32 %18, 24
%20 = ashr exact i32 %19, 24
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = tail call i32 @fclose(i32* %1)
%23 = tail call i32 @putchar(i32 10)
ret i32 0
}