#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 */
typedef int int32_t;

/* Variables and functions */
void prv_clamp_int8(int32_t *a, int32_t *b, int32_t *c, int32_t *d) {
  if (*a > 127)
    *a = 127;
  if (*a < -128)
    *a = -128;
  if (*b > 127)
    *b = 127;
  if (*b < -128)
    *b = -128;
  if (*c > 127)
    *c = 127;
  if (*c < -128)
    *c = -128;
  if (*d > 127)
    *d = 127;
  if (*d < -128)
    *d = -128;
}


x86 assembly (clang, -O0):
<prv_clamp_int8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x7f,(%rax)
jle    112b <prv_clamp_int8+0x2b>
mov    -0x8(%rbp),%rax
movl   $0x7f,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0xffffff80,(%rax)
jge    1142 <prv_clamp_int8+0x42>
mov    -0x8(%rbp),%rax
movl   $0xffffff80,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x7f,(%rax)
jle    1159 <prv_clamp_int8+0x59>
mov    -0x10(%rbp),%rax
movl   $0x7f,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xffffff80,(%rax)
jge    1170 <prv_clamp_int8+0x70>
mov    -0x10(%rbp),%rax
movl   $0xffffff80,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x7f,(%rax)
jle    1187 <prv_clamp_int8+0x87>
mov    -0x18(%rbp),%rax
movl   $0x7f,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xffffff80,(%rax)
jge    119e <prv_clamp_int8+0x9e>
mov    -0x18(%rbp),%rax
movl   $0xffffff80,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x7f,(%rax)
jle    11b5 <prv_clamp_int8+0xb5>
mov    -0x20(%rbp),%rax
movl   $0x7f,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0xffffff80,(%rax)
jge    11cc <prv_clamp_int8+0xcc>
mov    -0x20(%rbp),%rax
movl   $0xffffff80,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<prv_clamp_int8>:
mov    (%rdi),%eax
mov    $0x7f,%r8d
cmp    $0x7f,%eax
jg     111a <prv_clamp_int8+0x1a>
mov    $0xffffff80,%r8d
cmp    $0xffffff7f,%eax
jg     111d <prv_clamp_int8+0x1d>
mov    %r8d,(%rdi)
mov    (%rsi),%edi
mov    $0x7f,%eax
cmp    $0x7f,%edi
jg     1136 <prv_clamp_int8+0x36>
mov    $0xffffff80,%eax
cmp    $0xffffff7f,%edi
jg     1138 <prv_clamp_int8+0x38>
mov    %eax,(%rsi)
mov    (%rdx),%esi
mov    $0x7f,%eax
cmp    $0x7f,%esi
jg     1151 <prv_clamp_int8+0x51>
mov    $0xffffff80,%eax
cmp    $0xffffff7f,%esi
jg     1153 <prv_clamp_int8+0x53>
mov    %eax,(%rdx)
mov    (%rcx),%edx
mov    $0x7f,%eax
cmp    $0x7f,%edx
jg     116c <prv_clamp_int8+0x6c>
mov    $0xffffff80,%eax
cmp    $0xffffff7f,%edx
jg     116e <prv_clamp_int8+0x6e>
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @prv_clamp_int8(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = icmp sgt i32 %10, 127
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load i32*, i32** %5
store i32 127, i32* %13
br label %14
14: ; preds = %12, %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = icmp slt i32 %16, -128
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i32*, i32** %5
store i32 -128, i32* %19
br label %20
20: ; preds = %18, %14
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = icmp sgt i32 %22, 127
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = load i32*, i32** %6
store i32 127, i32* %25
br label %26
26: ; preds = %24, %20
%27 = load i32*, i32** %6
%28 = load i32, i32* %27
%29 = icmp slt i32 %28, -128
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32*, i32** %6
store i32 -128, i32* %31
br label %32
32: ; preds = %30, %26
%33 = load i32*, i32** %7
%34 = load i32, i32* %33
%35 = icmp sgt i32 %34, 127
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = load i32*, i32** %7
store i32 127, i32* %37
br label %38
38: ; preds = %36, %32
%39 = load i32*, i32** %7
%40 = load i32, i32* %39
%41 = icmp slt i32 %40, -128
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = load i32*, i32** %7
store i32 -128, i32* %43
br label %44
44: ; preds = %42, %38
%45 = load i32*, i32** %8
%46 = load i32, i32* %45
%47 = icmp sgt i32 %46, 127
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = load i32*, i32** %8
store i32 127, i32* %49
br label %50
50: ; preds = %48, %44
%51 = load i32*, i32** %8
%52 = load i32, i32* %51
%53 = icmp slt i32 %52, -128
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = load i32*, i32** %8
store i32 -128, i32* %55
br label %56
56: ; preds = %54, %50
ret void
}

LLVM IR (-O2):
define void @prv_clamp_int8(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = load i32, i32* %0
%6 = icmp sgt i32 %5, 127
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = icmp slt i32 %5, -128
br i1 %8, label %9, label %11
9: ; preds = %7, %4
%10 = phi i32 [ 127, %4 ], [ -128, %7 ]
store i32 %10, i32* %0
br label %11
11: ; preds = %9, %7
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 127
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = icmp slt i32 %12, -128
br i1 %15, label %16, label %18
16: ; preds = %14, %11
%17 = phi i32 [ 127, %11 ], [ -128, %14 ]
store i32 %17, i32* %1
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %2
%20 = icmp sgt i32 %19, 127
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = icmp slt i32 %19, -128
br i1 %22, label %23, label %25
23: ; preds = %21, %18
%24 = phi i32 [ 127, %18 ], [ -128, %21 ]
store i32 %24, i32* %2
br label %25
25: ; preds = %23, %21
%26 = load i32, i32* %3
%27 = icmp sgt i32 %26, 127
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = icmp slt i32 %26, -128
br i1 %29, label %30, label %32
30: ; preds = %28, %25
%31 = phi i32 [ 127, %25 ], [ -128, %28 ]
store i32 %31, i32* %3
br label %32
32: ; preds = %30, %28
ret void
}