#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ perror(char *);
void armInitializationCode(FILE *fp) {
  fprintf(fp, "; initialization\nldr r0, =0x20200000\nmov r1, #1\nlsl r1, "
              "#18\nstr r1, [r0, #4]\nmov r1, #1\nlsl r1, #16\nbeginning:\n");
  if (ferror(fp)) {
    perror("fprintf error in armInitializationCode\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<armInitializationCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1189 <armInitializationCode+0x49>
lea    0xefa(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<armInitializationCode>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
mov    $0x6f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    116c <armInitializationCode+0x2c>
pop    %rbx
ret
lea    0xefd(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [112 x i8] c"; initialization\0Aldr r0, =0x20200000\0Amov r1,\0Alsl r1,\0Astr r1, [r0,]\0Amov r1,\0Alsl r1,\0Abeginning:\0A\00"
@.str.1 = [40 x i8] c"fprintf error in armInitializationCode\0A\00"
@EXIT_FAILURE = global i32 0
define void @armInitializationCode(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i64 @ferror(i32* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [112 x i8] c"; initialization\0Aldr r0, =0x20200000\0Amov r1,\0Alsl r1,\0Astr r1, [r0,]\0Amov r1,\0Alsl r1,\0Abeginning:\0A\00"
@.str.1 = [40 x i8] c"fprintf error in armInitializationCode\0A\00"
@EXIT_FAILURE = global i32 0
define void @armInitializationCode(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str, i64 0, i64 0), i64 111, i64 1, i32* %0)
%3 = tail call i64 @ferror(i32* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret void
}