#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 opposite_sign_numbers(int, int);
int /*<<< orphan*/ printf(char *, ...);
int sign_bitwise(int);
int sign_direct(int);
int main() {
  int nums[8] = {1, -1, 8, -8, 16, -16, 100, -100};
  int i;
  for (i = 0; i < 8; i++) {
    printf("direct:  sign of %d: %d\n", nums[i], sign_direct(nums[i]));
  }
  printf("\n");
  for (i = 0; i < 8; i++) {
    printf("bitwise: sign of %d: %d\n", nums[i], sign_bitwise(nums[i]));
  }
  for (i = 1; i < 8; i++) {
    printf("do %d and %d have opposite signs?: %d\n", nums[0], nums[i],
           opposite_sign_numbers(nums[0], nums[i]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    11c5 <main+0x85>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1060 <sign_direct@plt>
mov    -0x38(%rbp),%esi
mov    %eax,%edx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1182 <main+0x42>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    121d <main+0xdd>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1040 <sign_bitwise@plt>
mov    -0x3c(%rbp),%esi
mov    %eax,%edx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11da <main+0x9a>
movl   $0x1,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    1273 <main+0x133>
mov    -0x30(%rbp),%eax
mov    %eax,-0x44(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%edi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
call   1050 <opposite_sign_numbers@plt>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    %eax,%ecx
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1224 <main+0xe4>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1070 <sign_direct@plt>
lea    0xe9e(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffff8,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0xfffffff8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x10,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffff0,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0xfffffff0,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x64,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffff9c,%edi
call   1070 <sign_direct@plt>
mov    %rbx,%rdi
mov    $0xffffff9c,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1050 <sign_bitwise@plt>
lea    0xdce(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffff8,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0xfffffff8,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x10,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffff0,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0xfffffff0,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x64,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffff9c,%edi
call   1050 <sign_bitwise@plt>
mov    %rbx,%rdi
mov    $0xffffff9c,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1060 <opposite_sign_numbers@plt>
lea    0xd03(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xffffffff,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1060 <opposite_sign_numbers@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xfffffff8,%esi
call   1060 <opposite_sign_numbers@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xfffffff8,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x10,%esi
call   1060 <opposite_sign_numbers@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xfffffff0,%esi
call   1060 <opposite_sign_numbers@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xfffffff0,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1060 <opposite_sign_numbers@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x64,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1060 <opposite_sign_numbers@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xffffff9c,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [8 x i32] [i32 1, i32 -1, i32 8, i32 -8, i32 16, i32 -16, i32 100, i32 -100]
@.str = [25 x i8] c"direct: sign of %d: %d\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [25 x i8] c"bitwise: sign of %d: %d\0A\00"
@.str.3 = [39 x i8] c"do %d and %d have opposite signs?: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @sign_direct(i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %24
24: ; preds = %38, %22
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 8
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = call i32 @sign_bitwise(i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %36)
br label %38
38: ; preds = %27
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %24
41: ; preds = %24
store i32 1, i32* %3
br label %42
42: ; preds = %60, %41
%43 = load i32, i32* %3
%44 = icmp slt i32 %43, 8
br i1 %44, label %45, label %63
45: ; preds = %42
%46 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%47 = load i32, i32* %46
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%53 = load i32, i32* %52
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = call i32 @opposite_sign_numbers(i32 %53, i32 %57)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %51, i32 %58)
br label %60
60: ; preds = %45
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %42
63: ; preds = %42
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"direct: sign of %d: %d\0A\00"
@.str.2 = [25 x i8] c"bitwise: sign of %d: %d\0A\00"
@.str.3 = [39 x i8] c"do %d and %d have opposite signs?: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @sign_direct(i32 1)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 1, i32 %1)
%3 = tail call i32 @sign_direct(i32 -1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 -1, i32 %3)
%5 = tail call i32 @sign_direct(i32 8)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 8, i32 %5)
%7 = tail call i32 @sign_direct(i32 -8)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 -8, i32 %7)
%9 = tail call i32 @sign_direct(i32 16)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 16, i32 %9)
%11 = tail call i32 @sign_direct(i32 -16)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 -16, i32 %11)
%13 = tail call i32 @sign_direct(i32 100)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 100, i32 %13)
%15 = tail call i32 @sign_direct(i32 -100)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 -100, i32 %15)
%17 = tail call i32 @putchar(i32 10)
%18 = tail call i32 @sign_bitwise(i32 1)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %18)
%20 = tail call i32 @sign_bitwise(i32 -1)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 -1, i32 %20)
%22 = tail call i32 @sign_bitwise(i32 8)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 %22)
%24 = tail call i32 @sign_bitwise(i32 -8)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 -8, i32 %24)
%26 = tail call i32 @sign_bitwise(i32 16)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 16, i32 %26)
%28 = tail call i32 @sign_bitwise(i32 -16)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 -16, i32 %28)
%30 = tail call i32 @sign_bitwise(i32 100)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 100, i32 %30)
%32 = tail call i32 @sign_bitwise(i32 -100)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 -100, i32 %32)
%34 = tail call i32 @opposite_sign_numbers(i32 1, i32 -1)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 -1, i32 %34)
%36 = tail call i32 @opposite_sign_numbers(i32 1, i32 8)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 8, i32 %36)
%38 = tail call i32 @opposite_sign_numbers(i32 1, i32 -8)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 -8, i32 %38)
%40 = tail call i32 @opposite_sign_numbers(i32 1, i32 16)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 16, i32 %40)
%42 = tail call i32 @opposite_sign_numbers(i32 1, i32 -16)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 -16, i32 %42)
%44 = tail call i32 @opposite_sign_numbers(i32 1, i32 100)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 100, i32 %44)
%46 = tail call i32 @opposite_sign_numbers(i32 1, i32 -100)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 -100, i32 %46)
ret i32 0
}