#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 abs(int);
int /*<<< orphan*/ prebroji(int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a = 0, zbrP = 0, zbrN = 0;
  int *ptrP = &zbrP;
  int *ptrN = &zbrN;
  printf("Unesite neki cijeli broj (do 9 znamenki): ");
  scanf("%9d", &a);
  printf("\n");
  if (a < 0)
    a = abs(a);
  prebroji(a, ptrP, ptrN);
  printf("Zbroj parnih: %d\nZbroj neparnih: %d\n", zbrP, zbrN);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11b5 <main+0x75>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <prebroji@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jns    1193 <main+0x53>
neg    %edi
mov    %edi,0xc(%rsp)
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1060 <prebroji@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Unesite neki cijeli broj (do 9 znamenki): \00"
@.str.1 = [4 x i8] c"%9d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [37 x i8] c"Zbroj parnih: %d\0AZbroj neparnih: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32* %3, i32** %5
store i32* %4, i32** %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 @abs(i32 %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %0
%16 = load i32, i32* %2
%17 = load i32*, i32** %5
%18 = load i32*, i32** %6
%19 = call i32 @prebroji(i32 %16, i32* %17, i32* %18)
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Unesite neki cijeli broj (do 9 znamenki): \00"
@.str.1 = [4 x i8] c"%9d\00"
@.str.3 = [37 x i8] c"Zbroj parnih: %d\0AZbroj neparnih: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @putchar(i32 10)
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = sub nsw i32 0, %10
store i32 %13, i32* %1
br label %14
14: ; preds = %12, %0
%15 = phi i32 [ %13, %12 ], [ %10, %0 ]
%16 = call i32 @prebroji(i32 %15, i32* %2, i32* %3)
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %18)
ret i32 0
}