#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pru_bridge_init(int *);
int /*<<< orphan*/ pru_channel_close(int);
int /*<<< orphan*/ pru_channel_open(int, int /*<<< orphan*/);
int /*<<< orphan*/ pru_read(int, int /*<<< orphan*/ *, int);
int main() {
  int size[5] = {100, 100, 100, 100, 100};
  pru_bridge_init(size);
  pru_channel_open(1, 0);
  pru_channel_open(2, 0);
  pru_channel_open(3, 0);
  pru_channel_open(4, 0);
  pru_channel_open(5, 0);
  int pru_data;
  pru_read(1, (uint8_t *)&pru_data, 4);
  printf("%d\n", pru_data);
  pru_read(2, (uint8_t *)&pru_data, 4);
  printf("%d\n", pru_data);
  pru_read(3, (uint8_t *)&pru_data, 4);
  printf("%d\n", pru_data);
  pru_read(4, (uint8_t *)&pru_data, 4);
  printf("%d\n", pru_data);
  pru_read(5, (uint8_t *)&pru_data, 4);
  printf("%d\n", pru_data);
  pru_channel_close(1);
  pru_channel_close(2);
  pru_channel_close(3);
  pru_channel_close(4);
  pru_channel_close(5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe95(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <pru_bridge_init@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x1,%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    -0x24(%rbp),%esi
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    -0x24(%rbp),%esi
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    -0x24(%rbp),%esi
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edx
lea    -0x24(%rbp),%rsi
mov    %edx,%edi
call   1070 <pru_read@plt>
mov    -0x24(%rbp),%esi
lea    0xdd1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    -0x24(%rbp),%esi
lea    0xdaf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <pru_channel_close@plt>
mov    $0x2,%edi
call   1030 <pru_channel_close@plt>
mov    $0x3,%edi
call   1030 <pru_channel_close@plt>
mov    $0x4,%edi
call   1030 <pru_channel_close@plt>
mov    $0x5,%edi
call   1030 <pru_channel_close@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xeb3(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1060 <pru_bridge_init@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1050 <pru_channel_open@plt>
lea    0xc(%rsp),%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    0xc(%rsp),%esi
lea    0xe3f(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1070 <pru_read@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <pru_channel_close@plt>
mov    $0x2,%edi
call   1030 <pru_channel_close@plt>
mov    $0x3,%edi
call   1030 <pru_channel_close@plt>
mov    $0x4,%edi
call   1030 <pru_channel_close@plt>
mov    $0x5,%edi
call   1030 <pru_channel_close@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.size = [5 x i32] [i32 100, i32 100, i32 100, i32 100, i32 100]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = call i32 @pru_bridge_init(i32* %5)
%7 = call i32 @pru_channel_open(i32 1, i32 0)
%8 = call i32 @pru_channel_open(i32 2, i32 0)
%9 = call i32 @pru_channel_open(i32 3, i32 0)
%10 = call i32 @pru_channel_open(i32 4, i32 0)
%11 = call i32 @pru_channel_open(i32 5, i32 0)
%12 = call i32 @pru_read(i32 1, i32* %3, i32 4)
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @pru_read(i32 2, i32* %3, i32 4)
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @pru_read(i32 3, i32* %3, i32 4)
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @pru_read(i32 4, i32* %3, i32 4)
%22 = load i32, i32* %3
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = call i32 @pru_read(i32 5, i32* %3, i32 4)
%25 = load i32, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i32 @pru_channel_close(i32 1)
%28 = call i32 @pru_channel_close(i32 2)
%29 = call i32 @pru_channel_close(i32 3)
%30 = call i32 @pru_channel_close(i32 4)
%31 = call i32 @pru_channel_close(i32 5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.size = [5 x i32] [i32 100, i32 100, i32 100, i32 100, i32 100]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @pru_bridge_init(i32* %4)
%6 = call i32 @pru_channel_open(i32 1, i32 0)
%7 = call i32 @pru_channel_open(i32 2, i32 0)
%8 = call i32 @pru_channel_open(i32 3, i32 0)
%9 = call i32 @pru_channel_open(i32 4, i32 0)
%10 = call i32 @pru_channel_open(i32 5, i32 0)
%11 = bitcast i32* %2 to i8*
%12 = call i32 @pru_read(i32 1, i32* %2, i32 4)
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @pru_read(i32 2, i32* %2, i32 4)
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @pru_read(i32 3, i32* %2, i32 4)
%19 = load i32, i32* %2
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @pru_read(i32 4, i32* %2, i32 4)
%22 = load i32, i32* %2
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = call i32 @pru_read(i32 5, i32* %2, i32 4)
%25 = load i32, i32* %2
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i32 @pru_channel_close(i32 1)
%28 = call i32 @pru_channel_close(i32 2)
%29 = call i32 @pru_channel_close(i32 3)
%30 = call i32 @pru_channel_close(i32 4)
%31 = call i32 @pru_channel_close(i32 5)
ret i32 0
}