#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 *, ...);
unsigned long strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Nombre de parametres insuffisant\n");
    return 1;
  }
  unsigned long ul;
  unsigned long ip1, ip2, ip3, ip4;
  unsigned long mask, temp;
  mask = 0xFF000000;
  ul = strtoul(argv[1], NULL, 0);
  temp = ul;
  ip1 = temp >> 24;
  mask = 0x000000FF;
  temp = ul;
  ip2 = (temp >> 16) & mask;
  mask = 0x0000FF00;
  ip3 = ul & mask;
  mask = 1023;
  mask = 0x000000FF;
  ip4 = ul & mask;
  printf("%lu.%lu.%lu.%lu", ip1, ip2, ip3, ip4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     115a <main+0x3a>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1203 <main+0xe3>
mov    $0xff000000,%eax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
shr    $0x18,%rax
mov    %rax,-0x20(%rbp)
movq   $0xff,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
shr    $0x10,%rax
and    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0xff00,-0x40(%rbp)
mov    -0x18(%rbp),%rax
and    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x3ff,-0x40(%rbp)
movq   $0xff,-0x40(%rbp)
mov    -0x18(%rbp),%rax
and    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1170 <main+0x40>
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtoul@plt>
mov    %eax,%edx
mov    %eax,%ecx
movzbl %al,%r8d
mov    %rax,%rsi
shr    $0x18,%rsi
shr    $0x10,%edx
movzbl %dl,%edx
and    $0xff00,%ecx
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1181 <main+0x51>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Nombre de parametres insuffisant\0A\00"
@.str.1 = [16 x i8] c"%lu.%lu.%lu.%lu\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 i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %41
17: ; preds = %2
store i64 4278190080, i64* %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strtoul(i8* %20, i32* null, i32 0)
store i64 %21, i64* %6
%22 = load i64, i64* %6
store i64 %22, i64* %12
%23 = load i64, i64* %12
%24 = lshr i64 %23, 24
store i64 %24, i64* %7
store i64 255, i64* %11
%25 = load i64, i64* %6
store i64 %25, i64* %12
%26 = load i64, i64* %12
%27 = lshr i64 %26, 16
%28 = load i64, i64* %11
%29 = and i64 %27, %28
store i64 %29, i64* %8
store i64 65280, i64* %11
%30 = load i64, i64* %6
%31 = load i64, i64* %11
%32 = and i64 %30, %31
store i64 %32, i64* %9
store i64 1023, i64* %11
store i64 255, i64* %11
%33 = load i64, i64* %6
%34 = load i64, i64* %11
%35 = and i64 %33, %34
store i64 %35, i64* %10
%36 = load i64, i64* %7
%37 = load i64, i64* %8
%38 = load i64, i64* %9
%39 = load i64, i64* %10
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %36, i64 %37, i64 %38, i64 %39)
store i32 0, i32* %3
br label %41
41: ; preds = %17, %15
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"%lu.%lu.%lu.%lu\00"
@str = [33 x i8] c"Nombre de parametres insuffisant\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %16
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strtoul(i8* nocapture %8, i32* null, i32 0)
%10 = lshr i64 %9, 24
%11 = lshr i64 %9, 16
%12 = and i64 %11, 255
%13 = and i64 %9, 65280
%14 = and i64 %9, 255
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %10, i64 %12, i64 %13, i64 %14)
br label %16
16: ; preds = %6, %4
%17 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %17
}