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

/* Variables and functions */
int /*<<< orphan*/ mbox_close(int);
int mbox_open();
int mbox_property(int, unsigned int *);
int /*<<< orphan*/ printf(char *, ...);
unsigned int strtoul(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int mb = mbox_open();
  unsigned words[256] = {};
  int i;
  if (argc < 2 || argc + 1 >= 256) {
    printf("Usage %s [word0] [word1] ...\n", argv[0]);
    return 1;
  }
  words[0] = (argc + 2) * sizeof words[0];
  words[1] = 0;
  for (i = 1; i < argc; i++)
    words[i + 1] = strtoul(argv[i], 0, 0);
  words[argc + 1] = 0;
  int s = mbox_property(mb, words);
  mbox_close(mb);
  for (i = 0; i < argc + 2; i++)
    printf("0x%08x ", words[i]);
  printf("\n");
  return s;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <mbox_open@plt>
mov    %eax,-0x14(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
jl     11b1 <main+0x51>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    $0x100,%eax
jl     11d2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12dc <main+0x17c>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x2,%rax
mov    %eax,-0x420(%rbp)
movl   $0x0,-0x41c(%rbp)
movl   $0x1,-0x424(%rbp)
mov    -0x424(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1247 <main+0xe7>
mov    -0x10(%rbp),%rax
movslq -0x424(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1080 <strtoul@plt>
mov    %eax,%ecx
mov    -0x424(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x420(%rbp,%rax,4)
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    11f8 <main+0x98>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
movl   $0x0,-0x420(%rbp,%rax,4)
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   1070 <mbox_property@plt>
mov    %eax,-0x428(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <mbox_close@plt>
movl   $0x0,-0x424(%rbp)
mov    -0x424(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    12c5 <main+0x165>
movslq -0x424(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%esi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    1281 <main+0x121>
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x428(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%rbp
mov    %edi,%r13d
xor    %eax,%eax
call   1070 <mbox_open@plt>
mov    %eax,%r14d
lea    0x10(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1050 <memset@plt>
cmp    $0x2,%r13d
jl     11b1 <main+0x41>
cmp    $0xff,%r13d
jb     11ce <main+0x5e>
mov    0x0(%rbp),%rsi
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r12d
jmp    1271 <main+0x101>
lea    0x1(%r13),%r12d
lea    0x2(%r13),%eax
mov    %eax,0xc(%rsp)
lea    0x8(,%r13,4),%eax
mov    %eax,0x10(%rsp)
mov    %r13d,%ebx
add    $0xffffffffffffffff,%rbx
xor    %r15d,%r15d
mov    0x8(%rbp,%r15,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <strtoul@plt>
mov    %eax,0x18(%rsp,%r15,4)
add    $0x1,%r15
cmp    %r15,%rbx
jne    11f0 <main+0x80>
movslq %r12d,%rax
movl   $0x0,0x10(%rsp,%rax,4)
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
call   1080 <mbox_property@plt>
mov    %eax,%r12d
mov    %r14d,%edi
call   1060 <mbox_close@plt>
cmp    $0xffffffff,%r13d
jl     1267 <main+0xf7>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
lea    0xdd3(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1250 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Usage %s [word0] [word1] ...\0A\00"
@.str.1 = [8 x i8] c"0x%08x \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [256 x i32]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @mbox_open()
store i32 %10, i32* %6
%11 = bitcast [256 x i32]* %7 to i8*
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = icmp sge i32 %16, 256
br i1 %17, label %18, label %23
18: ; preds = %14, %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %21)
store i32 1, i32* %3
br label %76
23: ; preds = %14
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 2
%26 = sext i32 %25 to i64
%27 = mul i64 %26, 4
%28 = trunc i64 %27 to i32
%29 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 0
store i32 %28, i32* %29
%30 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 1
store i32 0, i32* %30
store i32 1, i32* %8
br label %31
31: ; preds = %46, %23
%32 = load i32, i32* %8
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %49
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @strtoul(i8* %40, i32 0, i32 0)
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %44
store i32 %41, i32* %45
br label %46
46: ; preds = %35
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %31
49: ; preds = %31
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %52
store i32 0, i32* %53
%54 = load i32, i32* %6
%55 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 0
%56 = call i32 @mbox_property(i32 %54, i32* %55)
store i32 %56, i32* %9
%57 = load i32, i32* %6
%58 = call i32 @mbox_close(i32 %57)
store i32 0, i32* %8
br label %59
59: ; preds = %70, %49
%60 = load i32, i32* %8
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 2
%63 = icmp slt i32 %60, %62
br i1 %63, label %64, label %73
64: ; preds = %59
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %64
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %59
73: ; preds = %59
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%75 = load i32, i32* %9
store i32 %75, i32* %3
br label %76
76: ; preds = %73, %18
%77 = load i32, i32* %3
ret i32 %77
}

LLVM IR (-O2):
@.str = [30 x i8] c"Usage %s [word0] [word1] ...\0A\00"
@.str.1 = [8 x i8] c"0x%08x \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i32]
%4 = tail call i32 (...) @mbox_open()
%5 = bitcast [256 x i32]* %3 to i8*
%6 = icmp slt i32 %0, 2
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = add nuw nsw i32 %0, 1
%9 = icmp ugt i32 %0, 254
br i1 %9, label %10, label %13
10: ; preds = %7, %2
%11 = load i8*, i8** %1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %44
13: ; preds = %7
%14 = add nuw nsw i32 %0, 2
%15 = shl nuw nsw i32 %14, 2
%16 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 0
store i32 %15, i32* %16
%17 = zext i32 %0 to i64
br label %18
18: ; preds = %13, %18
%19 = phi i64 [ 1, %13 ], [ %23, %18 ]
%20 = getelementptr inbounds i8*, i8** %1, i64 %19
%21 = load i8*, i8** %20
%22 = tail call i32 @strtoul(i8* %21, i32 0, i32 0)
%23 = add nuw nsw i64 %19, 1
%24 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %23
store i32 %22, i32* %24
%25 = icmp eq i64 %23, %17
br i1 %25, label %26, label %18
26: ; preds = %18
%27 = sext i32 %8 to i64
%28 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %27
store i32 0, i32* %28
%29 = call i32 @mbox_property(i32 %4, i32* %16)
%30 = call i32 @mbox_close(i32 %4)
%31 = icmp sgt i32 %0, -2
br i1 %31, label %32, label %42
32: ; preds = %26
%33 = call i32 @llvm.smax.i32(i32 %14, i32 1)
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %32, %35
%36 = phi i64 [ 0, %32 ], [ %40, %35 ]
%37 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = add nuw nsw i64 %36, 1
%41 = icmp eq i64 %40, %34
br i1 %41, label %42, label %35
42: ; preds = %35, %26
%43 = call i32 @putchar(i32 10)
br label %44
44: ; preds = %42, %10
%45 = phi i32 [ 1, %10 ], [ %29, %42 ]
ret i32 %45
}