#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, unsigned long);
int sscanf(char *, char *, unsigned long *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  int argi;
  unsigned long x;
  if (argc < 2)
    usage(argv[0]);
  for (argi = 1; argi < argc; argi++) {
    if (sscanf(argv[argi], "%lu", &x) == 1) {
      printf("0%lo\n", x);
    } else {
      fprintf(stderr, "Couldn't parse argument \"%s\" as decimal integer.\n",
              argv[argi]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116c <main+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ed <main+0xad>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe6e(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11b9 <main+0x79>
mov    -0x20(%rbp),%rsi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
jmp    11da <main+0x9a>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe35(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11df <main+0x9f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1173 <main+0x33>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     116c <main+0x2c>
mov    (%rbx),%rdi
call   1060 <usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %edi,%ebp
mov    $0x1,%r12d
lea    0xe85(%rip),%r14
mov    %rsp,%r15
lea    0xe85(%rip),%r13
jmp    11ae <main+0x6e>
nopw   0x0(%rax,%rax,1)
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    (%rbx,%r12,8),%rdx
mov    %r13,%rsi
call   1040 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     115b <main+0x1b>
mov    (%rbx,%r12,8),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1190 <main+0x50>
mov    (%rsp),%rsi
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <main+0x65>

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [6 x i8] c"0%lo\0A\00"
@stderr = global i32 0
@.str.2 = [50 x i8] c"Couldn't parse argument \22%s\22 as decimal integer.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @usage(i8* %13)
br label %15
15: ; preds = %10, %2
store i32 1, i32* %6
br label %16
16: ; preds = %40, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %43
20: ; preds = %16
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %7)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = load i64, i64* %7
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %29)
br label %39
31: ; preds = %20
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %5
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %31, %28
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %16
43: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
@.str.1 = [6 x i8] c"0%lo\0A\00"
@stderr = global i32 0
@.str.2 = [50 x i8] c"Couldn't parse argument \22%s\22 as decimal integer.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @usage(i8* %7)
br label %27
9: ; preds = %2
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %24
%12 = phi i64 [ 1, %9 ], [ %25, %24 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i64, i64* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %18)
br label %24
20: ; preds = %11
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %13
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %17, %20
%25 = add nuw nsw i64 %12, 1
%26 = icmp eq i64 %25, %10
br i1 %26, label %27, label %11
27: ; preds = %24, %6
ret i32 0
}