#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*/ printf(char *, int);
int main(int argc, char *argv[]) {
  if (argc < 2)
    return 1;
  long int decimalNumber, remainder, quotient;
  int octalNumber[100], i = 1, j;
  decimalNumber = (int)argv[1][0];
  quotient = decimalNumber;
  while (quotient != 0) {
    octalNumber[i++] = quotient % 8;
    quotient = quotient / 8;
  }
  printf("Equivalent octal value of decimal number %d: \n", decimalNumber);
  for (j = i - 1; j > 0; j--)
    printf("%d", octalNumber[j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    113f <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1211 <main+0x101>
movl   $0x1,-0x1c4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ae <main+0x9e>
mov    -0x28(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %edx,%ecx
mov    -0x1c4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1c4(%rbp)
cltq
mov    %ecx,-0x1c0(%rbp,%rax,4)
mov    -0x28(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %rax,-0x28(%rbp)
jmp    1162 <main+0x52>
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c8(%rbp)
cmpl   $0x0,-0x1c8(%rbp)
jle    120a <main+0xfa>
movslq -0x1c8(%rbp),%rax
mov    -0x1c0(%rbp,%rax,4),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c8(%rbp)
jmp    11cf <main+0xbf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     11c2 <main+0xb2>
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    0x8(%rsi),%rax
movsbl (%rax),%esi
test   %esi,%esi
je     11aa <main+0x9a>
movslq %esi,%rcx
mov    $0x1,%ebx
mov    %rcx,%rax
xchg   %ax,%ax
lea    0x7(%rcx),%rdx
test   %rcx,%rcx
cmovs  %rdx,%rax
sar    $0x3,%rax
lea    0x0(,%rax,8),%edi
sub    %edi,%ecx
mov    %ecx,(%rsp,%rbx,4)
add    $0x1,%rbx
mov    %rax,%rcx
cmp    $0xe,%rdx
ja     1140 <main+0x30>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x2,%ebx
jl     11b6 <main+0xa6>
mov    %ebx,%ebx
add    $0x1,%rbx
lea    0xea9(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    (%rsp,%rax,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
ja     1190 <main+0x80>
jmp    11b6 <main+0xa6>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Equivalent octal value of decimal number %d: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca [100 x i32]
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 1, i32* %3
br label %56
15: ; preds = %2
store i32 1, i32* %10
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sext i32 %21 to i64
store i64 %22, i64* %6
%23 = load i64, i64* %6
store i64 %23, i64* %8
br label %24
24: ; preds = %27, %15
%25 = load i64, i64* %8
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i64, i64* %8
%29 = srem i64 %28, 8
%30 = trunc i64 %29 to i32
%31 = load i32, i32* %10
%32 = add nsw i32 %31, 1
store i32 %32, i32* %10
%33 = sext i32 %31 to i64
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 %33
store i32 %30, i32* %34
%35 = load i64, i64* %8
%36 = sdiv i64 %35, 8
store i64 %36, i64* %8
br label %24
37: ; preds = %24
%38 = load i64, i64* %6
%39 = trunc i64 %38 to i32
%40 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %10
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %11
br label %43
43: ; preds = %52, %37
%44 = load i32, i32* %11
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %55
46: ; preds = %43
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %11
%54 = add nsw i32 %53, -1
store i32 %54, i32* %11
br label %43
55: ; preds = %43
store i32 0, i32* %3
br label %56
56: ; preds = %55, %14
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@.str = [47 x i8] c"Equivalent octal value of decimal number %d: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i32]
%4 = icmp slt i32 %0, 2
br i1 %4, label %41, label %5
5: ; preds = %2
%6 = bitcast [100 x i32]* %3 to i8*
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i8 %9, 0
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %40
14: ; preds = %5
%15 = sext i8 %9 to i64
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 1, %14 ], [ %21, %16 ]
%18 = phi i64 [ %15, %14 ], [ %23, %16 ]
%19 = srem i64 %18, 8
%20 = trunc i64 %19 to i32
%21 = add nuw i64 %17, 1
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %17
store i32 %20, i32* %22
%23 = sdiv i64 %18, 8
%24 = add nsw i64 %18, 7
%25 = icmp ult i64 %24, 15
br i1 %25, label %26, label %16
26: ; preds = %16
%27 = trunc i64 %21 to i32
%28 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %10)
%29 = icmp sgt i32 %27, 1
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = and i64 %21, 4294967295
br label %32
32: ; preds = %30, %32
%33 = phi i64 [ %31, %30 ], [ %34, %32 ]
%34 = add nsw i64 %33, -1
%35 = and i64 %34, 4294967295
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = icmp ugt i64 %33, 2
br i1 %39, label %32, label %40
40: ; preds = %32, %12, %26
br label %41
41: ; preds = %2, %40
%42 = phi i32 [ 0, %40 ], [ 1, %2 ]
ret i32 %42
}