#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 atol(char *);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  int num = atol(argv[1]);
  printf("%i %s\n", num, argv[1]);
  int aligned = num % 8 == 0 ? num : num - num % 8 + 8;
  printf("%ld %ld\n", num, aligned);
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <main+0x5e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    119a <main+0x7a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
sub    %edx,%eax
add    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%r14
mov    %r14,%rdi
call   1040 <atol@plt>
mov    %eax,%ebx
lea    0xec7(%rip),%rdi
mov    %eax,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
lea    0x8(%rax),%edx
cmp    %eax,%ebx
cmove  %ebx,%edx
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%i %s\0A\00"
@.str.1 = [9 x i8] c"%ld %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atol(i8* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %15)
%17 = load i32, i32* %6
%18 = srem i32 %17, 8
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = load i32, i32* %6
br label %28
22: ; preds = %2
%23 = load i32, i32* %6
%24 = load i32, i32* %6
%25 = srem i32 %24, 8
%26 = sub nsw i32 %23, %25
%27 = add nsw i32 %26, 8
br label %28
28: ; preds = %22, %20
%29 = phi i32 [ %21, %20 ], [ %27, %22 ]
store i32 %29, i32* %7
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%i %s\0A\00"
@.str.1 = [9 x i8] c"%ld %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atol(i8* %4)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %4)
%7 = srem i32 %5, 8
%8 = icmp eq i32 %7, 0
%9 = add i32 %5, 8
%10 = sub i32 %9, %7
%11 = select i1 %8, i32 %5, i32 %10
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %11)
ret i32 0
}