#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 *, char *, int, int);
int /*<<< orphan*/ perror(char *);
void encodeDash(FILE *fp, int loopNumber) {
  fprintf(fp,
          "; ON 3 units\nstr r1, [r0, #40]\nldr r2, =%s\nwait%i:\nsub r2, r2, "
          "#0x1\ncmp r2, #0\nbge wait%i\n",
          "0x300000", loopNumber, loopNumber);
  if (ferror(fp)) {
    perror("fprint error in encodeDot");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<encodeDash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe9f(%rip),%rsi
lea    0xef3(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     119a <encodeDash+0x5a>
lea    0xedd(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encodeDash>:
push   %rbx
mov    %esi,%ecx
mov    %rdi,%rbx
lea    0xeb3(%rip),%rsi
lea    0xf07(%rip),%rdx
mov    %ecx,%r8d
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    116b <encodeDash+0x2b>
pop    %rbx
ret
lea    0xef2(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [91 x i8] c"; ON 3 units\0Astr r1, [r0,]\0Aldr r2, =%s\0Await%i:\0Asub r2, r2,x1\0Acmp r2,\0Abge wait%i\0A\00"
@.str.1 = [9 x i8] c"0x300000\00"
@.str.2 = [26 x i8] c"fprint error in encodeDot\00"
@EXIT_FAILURE = global i32 0
define void @encodeDash(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32*, i32** %3
%10 = call i64 @ferror(i32* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [91 x i8] c"; ON 3 units\0Astr r1, [r0,]\0Aldr r2, =%s\0Await%i:\0Asub r2, r2,x1\0Acmp r2,\0Abge wait%i\0A\00"
@.str.1 = [9 x i8] c"0x300000\00"
@.str.2 = [26 x i8] c"fprint error in encodeDot\00"
@EXIT_FAILURE = global i32 0
define void @encodeDash(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %1)
%4 = tail call i64 @ferror(i32* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret void
}