#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int num;
  printf("Introdueix un numero: ");
  scanf("%d", &num);
  if (num == 0)
    printf("\nEl numero introduït és cero.\n");
  else if (num > 0)
    printf("\nEl numero introduït és positiu.\n");
  else
    printf("\nEl numero introduït és negatiu.\n");
  return (EXIT_SUCCESS);
}


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)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    116d <main+0x4d>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x79>
cmpl   $0x0,-0x14(%rbp)
jle    1188 <main+0x68>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1194 <main+0x74>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <main+0x79>
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
lea    0xee3(%rip),%rax
lea    0xeb9(%rip),%rcx
cmovg  %rax,%rcx
lea    0xef4(%rip),%rdi
cmovne %rcx,%rdi
call   1030 <puts@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Introdueix un numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0AEl numero introdu\C3\AFt \C3\A9s cero.\0A\00"
@.str.3 = [36 x i8] c"\0AEl numero introdu\C3\AFt \C3\A9s positiu.\0A\00"
@.str.4 = [36 x i8] c"\0AEl numero introdu\C3\AFt \C3\A9s negatiu.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %21
13: ; preds = %2
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %11
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
@.str = [23 x i8] c"Introdueix un numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
@str = [35 x i8] c"\0AEl numero introdu\C3\AFt \C3\A9s negatiu.\00"
@str.5 = [35 x i8] c"\0AEl numero introdu\C3\AFt \C3\A9s positiu.\00"
@str.6 = [32 x i8] c"\0AEl numero introdu\C3\AFt \C3\A9s cero.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
%9 = icmp sgt i32 %7, 0
%10 = select i1 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0), i8* %10
%12 = call i32 @puts(i8* dereferenceable(1) %11)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}