#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 uint16_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ getuid();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ testClearLcd(int);
int /*<<< orphan*/ testFilledBox(int);
int /*<<< orphan*/ testImage(int);
int /*<<< orphan*/ testPwm();
int /*<<< orphan*/ testSetPixel(int);
int main(void) {
  if (getuid() != 0) {
    fprintf(stderr, "you must be root to run this program\n");
    exit(EXIT_FAILURE);
  }
  uint16_t angle = 0;
  for (angle = 0; angle < 360; angle += 90)
    testClearLcd(angle);
  for (angle = 0; angle < 360; angle += 90)
    testFilledBox(angle);
  for (angle = 0; angle < 360; angle += 90)
    testSetPixel(angle);
  for (angle = 0; angle < 360; angle += 90)
    testImage(angle);
  testPwm();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
cmp    $0x0,%rax
je     11c3 <main+0x43>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jge    11f4 <main+0x74>
mov    -0x8(%rbp),%edi
call   1090 <testClearLcd@plt>
mov    -0x8(%rbp),%eax
add    $0x5a,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0x51>
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jge    121e <main+0x9e>
mov    -0x8(%rbp),%edi
call   1040 <testFilledBox@plt>
mov    -0x8(%rbp),%eax
add    $0x5a,%eax
mov    %eax,-0x8(%rbp)
jmp    11fb <main+0x7b>
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jge    1248 <main+0xc8>
mov    -0x8(%rbp),%edi
call   1050 <testSetPixel@plt>
mov    -0x8(%rbp),%eax
add    $0x5a,%eax
mov    %eax,-0x8(%rbp)
jmp    1225 <main+0xa5>
movl   $0x0,-0x8(%rbp)
cmpl   $0x168,-0x8(%rbp)
jge    1272 <main+0xf2>
mov    -0x8(%rbp),%edi
call   1070 <testImage@plt>
mov    -0x8(%rbp),%eax
add    $0x5a,%eax
mov    %eax,-0x8(%rbp)
jmp    124f <main+0xcf>
mov    $0x0,%al
call   1080 <testPwm@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getuid@plt>
test   %rax,%rax
jne    1230 <main+0xb0>
xor    %edi,%edi
call   1090 <testClearLcd@plt>
mov    $0x5a,%edi
call   1090 <testClearLcd@plt>
mov    $0xb4,%edi
call   1090 <testClearLcd@plt>
mov    $0x10e,%edi
call   1090 <testClearLcd@plt>
xor    %edi,%edi
call   1040 <testFilledBox@plt>
mov    $0x5a,%edi
call   1040 <testFilledBox@plt>
mov    $0xb4,%edi
call   1040 <testFilledBox@plt>
mov    $0x10e,%edi
call   1040 <testFilledBox@plt>
xor    %edi,%edi
call   1050 <testSetPixel@plt>
mov    $0x5a,%edi
call   1050 <testSetPixel@plt>
mov    $0xb4,%edi
call   1050 <testSetPixel@plt>
mov    $0x10e,%edi
call   1050 <testSetPixel@plt>
xor    %edi,%edi
call   1070 <testImage@plt>
mov    $0x5a,%edi
call   1070 <testImage@plt>
mov    $0xb4,%edi
call   1070 <testImage@plt>
mov    $0x10e,%edi
call   1070 <testImage@plt>
xor    %eax,%eax
call   1080 <testPwm@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
lea    0xdc0(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"you must be root to run this program\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i64 (...) @getuid()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
store i32 0, i32* %2
store i32 0, i32* %2
br label %11
11: ; preds = %17, %10
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 360
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = call i32 @testClearLcd(i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 90
store i32 %19, i32* %2
br label %11
20: ; preds = %11
store i32 0, i32* %2
br label %21
21: ; preds = %27, %20
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 360
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %2
%26 = call i32 @testFilledBox(i32 %25)
br label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 90
store i32 %29, i32* %2
br label %21
30: ; preds = %21
store i32 0, i32* %2
br label %31
31: ; preds = %37, %30
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 360
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* %2
%36 = call i32 @testSetPixel(i32 %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 90
store i32 %39, i32* %2
br label %31
40: ; preds = %31
store i32 0, i32* %2
br label %41
41: ; preds = %47, %40
%42 = load i32, i32* %2
%43 = icmp slt i32 %42, 360
br i1 %43, label %44, label %50
44: ; preds = %41
%45 = load i32, i32* %2
%46 = call i32 @testImage(i32 %45)
br label %47
47: ; preds = %44
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 90
store i32 %49, i32* %2
br label %41
50: ; preds = %41
%51 = call i32 (...) @testPwm()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"you must be root to run this program\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = tail call i64 (...) @getuid()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %21
3: ; preds = %0
%4 = tail call i32 @testClearLcd(i32 0)
%5 = tail call i32 @testClearLcd(i32 90)
%6 = tail call i32 @testClearLcd(i32 180)
%7 = tail call i32 @testClearLcd(i32 270)
%8 = tail call i32 @testFilledBox(i32 0)
%9 = tail call i32 @testFilledBox(i32 90)
%10 = tail call i32 @testFilledBox(i32 180)
%11 = tail call i32 @testFilledBox(i32 270)
%12 = tail call i32 @testSetPixel(i32 0)
%13 = tail call i32 @testSetPixel(i32 90)
%14 = tail call i32 @testSetPixel(i32 180)
%15 = tail call i32 @testSetPixel(i32 270)
%16 = tail call i32 @testImage(i32 0)
%17 = tail call i32 @testImage(i32 90)
%18 = tail call i32 @testImage(i32 180)
%19 = tail call i32 @testImage(i32 270)
%20 = tail call i32 (...) @testPwm()
ret i32 0
21: ; preds = %0
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
}