#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 convert_to_grayscale(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_bits(unsigned int);
int main(int argc, char *argv[]) {
  unsigned int pixels[] = {0xAA112233, 0xBB334455}, m, n, size = 0, p = 0;
  size = 2;
  printf("%x", convert_to_grayscale(*pixels));
  for (p = 0; p < size; p++) {
    printf("\nThe decimal %u is equal to binary - ", pixels[p]);
    show_bits(pixels[p]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x2,-0x24(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <convert_to_grayscale@plt>
mov    %eax,%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    11c0 <main+0x90>
mov    -0x28(%rbp),%eax
mov    -0x18(%rbp,%rax,4),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
mov    -0x18(%rbp,%rax,4),%edi
call   1050 <show_bits@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1185 <main+0x55>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xaa112233,%edi
call   1050 <convert_to_grayscale@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea1(%rip),%rbx
mov    %rbx,%rdi
mov    $0xaa112233,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xaa112233,%edi
call   1060 <show_bits@plt>
mov    %rbx,%rdi
mov    $0xbb334455,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xbb334455,%edi
call   1060 <show_bits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.pixels = [2 x i32] [i32 -1441717709, i32 -1154268075]
@.str = [3 x i8] c"%x\00"
@.str.1 = [38 x i8] c"\0AThe decimal %u is equal to binary - \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 [2 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [2 x i32]* %6 to i8*
store i32 0, i32* %9
store i32 0, i32* %10
store i32 2, i32* %9
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%13 = load i32, i32* %12
%14 = call i32 @convert_to_grayscale(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
store i32 0, i32* %10
br label %16
16: ; preds = %31, %2
%17 = load i32, i32* %10
%18 = load i32, i32* %9
%19 = icmp ult i32 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = load i32, i32* %10
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %10
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = call i32 @show_bits(i32 %29)
br label %31
31: ; preds = %20
%32 = load i32, i32* %10
%33 = add i32 %32, 1
store i32 %33, i32* %10
br label %16
34: ; preds = %16
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
@.str.1 = [38 x i8] c"\0AThe decimal %u is equal to binary - \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @convert_to_grayscale(i32 -1441717709)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 -1441717709)
%6 = tail call i32 @show_bits(i32 -1441717709)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 -1154268075)
%8 = tail call i32 @show_bits(i32 -1154268075)
%9 = tail call i32 @putchar(i32 10)
ret i32 0
}