#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*/ calc_min(int);
int /*<<< orphan*/ calc_smax(int);
int /*<<< orphan*/ calc_umax(int);
int /*<<< orphan*/ printf(char *, ...);
void calc(int bit, char s[]) {
  printf("%s\n", s);
  printf("signed\t");
  calc_smax(bit);
  calc_min(bit);
  printf("\nunsigned\t");
  calc_umax(bit);
  printf("\n");
}


x86 assembly (clang, -O0):
<calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <calc_smax@plt>
mov    -0x4(%rbp),%edi
call   1050 <calc_min@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <calc_umax@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%edi
call   1080 <calc_smax@plt>
mov    %ebx,%edi
call   1070 <calc_min@plt>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%edi
call   1050 <calc_umax@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [8 x i8] c"signed\09\00"
@.str.2 = [11 x i8] c"\0Aunsigned\09\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @calc(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 @calc_smax(i32 %8)
%10 = load i32, i32* %3
%11 = call i32 @calc_min(i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = call i32 @calc_umax(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"signed\09\00"
@.str.2 = [11 x i8] c"\0Aunsigned\09\00"
define void @calc(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @calc_smax(i32 %0)
%6 = tail call i32 @calc_min(i32 %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @calc_umax(i32 %0)
%9 = tail call i32 @putchar(i32 10)
ret void
}