xunge/DecIR huggingface dataset:
unsigned min3(unsigned v1, unsigned v2, unsigned v3) {
  if (v1 < v2) {
    if (v3 < v1) {
      return v3;
    } else {
      return v1;
    }
  } else {
    if (v3 < v2) {
      return v3;
    } else {
      return v2;
    }
  }
}


x86 assembly (clang, -O0):
<min3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    113b <min3+0x3b>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1130 <min3+0x30>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min3+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min3+0x58>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1152 <min3+0x52>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min3+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min3>:
mov    %edi,%eax
cmp    %edi,%edx
cmovb  %edx,%eax
cmp    %esi,%eax
cmovae %esi,%eax
ret

LLVM IR (-O0):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* %7
store i32 %16, i32* %4
br label %27
17: ; preds = %11
%18 = load i32, i32* %5
store i32 %18, i32* %4
br label %27
19: ; preds = %3
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = icmp ult i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %7
store i32 %24, i32* %4
br label %27
25: ; preds = %19
%26 = load i32, i32* %6
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %23, %17, %15
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %2, %0
%5 = select i1 %4, i32 %2, i32 %0
%6 = icmp ult i32 %5, %1
%7 = select i1 %6, i32 %5, i32 %1
ret i32 %7
}
cbuf40(f, n) { return (cbuf(f, n, 40)); }


x86 assembly (clang, -O0):
<cbuf40>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x28,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf40>:
mov    $0x28,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf40(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %5, i32 %6, i32 40)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf40(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 40)
ret i32 %3
}
struct passwd *getpwnam(const char *name) {
  return 0;
}


x86 assembly (clang, -O0):
<getpwnam>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getpwnam>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.passwd = type opaque
define %struct.passwd* @getpwnam(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret %struct.passwd* null
}

LLVM IR (-O2):
%struct.passwd = type opaque
define noalias %struct.passwd* @getpwnam(i8* nocapture readnone %0) {
ret %struct.passwd* null
}
void *memmove(void *__dest, const void *__src, unsigned long int __len) {
  char *return_value___builtin___memmove_chk$1;
  return_value___builtin___memmove_chk$1 = __builtin___memmove_chk(
      __dest, __src, (unsigned int)__len, 18446744073709551615ul);
  return (void *)return_value___builtin___memmove_chk$1;
}


x86 assembly (clang, -O0):
<memmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    %eax,%eax
mov    %eax,%edx
mov    $0xffffffffffffffff,%rcx
call   1030 <__memmove_chk@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove>:
mov    %edx,%edx
jmp    1030 <memmove@plt>

LLVM IR (-O0):
define i8* @memmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = trunc i64 %10 to i32
%12 = zext i32 %11 to i64
%13 = call i8* @__memmove_chk(i8* %8, i8* %9, i64 %12, i64 -1)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
ret i8* %14
}

LLVM IR (-O2):
define i8* @memmove(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
%4 = and i64 %2, 4294967295
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %4, i1 false)
ret i8* %0
}
int test_ptr(const int *const no1, const int *const no2) {
  return (*no1 + *no2);
}


x86 assembly (clang, -O0):
<test_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
add    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ptr>:
mov    (%rsi),%eax
add    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @test_ptr(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_ptr(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = add nsw i32 %4, %3
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *, char const *);
void pce_client_version(FILE *out) {
  static const char prog_str[] = "pce client";
  static const char ver_str[] = "1.1";
  static const char author_str[] = "Paolo Rovelli";
  fprintf(out, "%s %s written by %s\n", prog_str, ver_str, author_str);
  fflush(out);
  return;
}


x86 assembly (clang, -O0):
<pce_client_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xee6(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xec6(%rip),%rcx
lea    0xec3(%rip),%r8
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pce_client_version>:
push   %rbx
mov    %rdi,%rbx
lea    0xef2(%rip),%rsi
lea    0xece(%rip),%rdx
lea    0xed2(%rip),%rcx
lea    0xecf(%rip),%r8
call   1030 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@pce_client_version.prog_str = internal constant [11 x i8] c"pce client\00"
@pce_client_version.ver_str = internal constant [4 x i8] c"1.1\00"
@pce_client_version.author_str = internal constant [14 x i8] c"Paolo Rovelli\00"
@.str = [21 x i8] c"%s %s written by %s\0A\00"
define void @pce_client_version(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @pce_client_version.prog_str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @pce_client_version.ver_str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @pce_client_version.author_str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fflush(i32* %5)
ret void
}

LLVM IR (-O2):
@pce_client_version.prog_str = internal constant [11 x i8] c"pce client\00"
@pce_client_version.ver_str = internal constant [4 x i8] c"1.1\00"
@pce_client_version.author_str = internal constant [14 x i8] c"Paolo Rovelli\00"
@.str = [21 x i8] c"%s %s written by %s\0A\00"
define void @pce_client_version(i32* nocapture %0) {
%2 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @pce_client_version.prog_str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @pce_client_version.ver_str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @pce_client_version.author_str, i64 0, i64 0))
%3 = tail call i32 @fflush(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
unsigned int logic_byte_is_zero(unsigned char to_compare, char *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (to_compare == 0);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<logic_byte_is_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1149 <logic_byte_is_zero+0x39>
movl   $0x2,-0x14(%rbp)
jmp    1160 <logic_byte_is_zero+0x50>
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logic_byte_is_zero>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     112f <logic_byte_is_zero+0x1f>
test   %bpl,%bpl
sete   (%rbx)
xor    %eax,%eax
jmp    1134 <logic_byte_is_zero+0x24>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @logic_byte_is_zero(i8 zeroext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
store i8 %0, i8* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @assert(i8* %6)
store i32 0, i32* %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 2, i32* %5
br label %18
11: ; preds = %2
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
store i8 %16, i8* %17
br label %18
18: ; preds = %11, %10
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @logic_byte_is_zero(i8 zeroext %0, i8* %1) {
%3 = tail call i32 @assert(i8* %1)
%4 = icmp eq i8* %1, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = icmp eq i8 %0, 0
%7 = zext i1 %6 to i8
store i8 %7, i8* %1
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 0, %5 ], [ 2, %2 ]
ret i32 %9
}
int mlx5e_ipsec_init(struct mlx5e_priv *priv) { return 0; }


x86 assembly (clang, -O0):
<mlx5e_ipsec_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlx5e_ipsec_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.mlx5e_priv = type opaque
define i32 @mlx5e_ipsec_init(%struct.mlx5e_priv* %0) {
%2 = alloca %struct.mlx5e_priv*
store %struct.mlx5e_priv* %0, %struct.mlx5e_priv** %2
ret i32 0
}

LLVM IR (-O2):
%struct.mlx5e_priv = type opaque
define i32 @mlx5e_ipsec_init(%struct.mlx5e_priv* nocapture readnone %0) {
ret i32 0
}
float obdConvert_23(unsigned int A, unsigned int B, unsigned int C,
                    unsigned int D) {
  return ((float)A * 256.0f + (float)B) * 10.0f;
}


x86 assembly (clang, -O0):
<obdConvert_23>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2ss %rax,%xmm0
mov    -0x8(%rbp),%eax
cvtsi2ss %rax,%xmm1
movss  0xedc(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xec8(%rip),%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obdConvert_23>:
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
mov    %esi,%eax
cvtsi2ss %rax,%xmm1
mulss  0xeea(%rip),%xmm0
addss  %xmm1,%xmm0
mulss  0xee2(%rip),%xmm0
ret

LLVM IR (-O0):
define float @obdConvert_23(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 = uitofp i32 %9 to float
%11 = load i32, i32* %6
%12 = uitofp i32 %11 to float
%13 = call float @llvm.fmuladd.f32(float %10, float 2.560000e+02, float %12)
%14 = fmul float %13, 1.000000e+01
ret float %14
}

LLVM IR (-O2):
define float @obdConvert_23(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = uitofp i32 %0 to float
%6 = uitofp i32 %1 to float
%7 = tail call float @llvm.fmuladd.f32(float %5, float 2.560000e+02, float %6)
%8 = fmul float %7, 1.000000e+01
ret float %8
}
/* Variables and functions */
scalar_t__ isNumRex(char);
scalar_t__ isStartWordExpRex(char);
int isWordRex(char ch) { return (isStartWordExpRex(ch)) || (isNumRex(ch)); }


x86 assembly (clang, -O0):
<isWordRex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isStartWordExpRex@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <isWordRex+0x3c>
movsbl -0x1(%rbp),%edi
call   1040 <isNumRex@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isWordRex>:
push   %rbx
mov    %edi,%ebx
call   1030 <isStartWordExpRex@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <isWordRex+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1040 <isNumRex@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isWordRex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isStartWordExpRex(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @isNumRex(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isWordRex(i8 signext %0) {
%2 = tail call i64 @isStartWordExpRex(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @isNumRex(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
char *nextCity(char *);
char *nextPath(char *path, int n) {
  if (n <= 0)
    return path;
  else
    return nextPath(nextCity(path), n - 1);
}


x86 assembly (clang, -O0):
<nextPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     1146 <nextPath+0x26>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1161 <nextPath+0x41>
mov    -0x10(%rbp),%rdi
call   1040 <nextCity@plt>
mov    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
call   1030 <nextPath@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextPath>:
push   %rbx
mov    %rdi,%rax
test   %esi,%esi
jle    1130 <nextPath+0x20>
mov    %esi,%ebx
add    $0x1,%ebx
nopl   (%rax)
mov    %rax,%rdi
call   1030 <nextCity@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <nextPath+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define i8* @nextPath(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i8*, i8** %4
store i8* %9, i8** %3
br label %16
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i8* @nextCity(i8* %11)
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
%15 = call i8* @nextPath(i8* %12, i32 %14)
store i8* %15, i8** %3
br label %16
16: ; preds = %10, %8
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @nextPath(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %1, %2 ]
%6 = phi i8* [ %7, %4 ], [ %0, %2 ]
%7 = tail call i8* @nextCity(i8* %6)
%8 = add nsw i32 %5, -1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i8* [ %0, %2 ], [ %7, %4 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ put_dec_proc();
int /*<<< orphan*/ put_str_proc();
void end_program() {
  put_str_proc();
  put_dec_proc();
  printf("\tEND main\n");
}


x86 assembly (clang, -O0):
<end_program>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <put_str_proc@plt>
mov    $0x0,%al
call   1040 <put_dec_proc@plt>
lea    0xeb7(%rip),%rdi
call   1050 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_program>:
push   %rax
xor    %eax,%eax
call   1040 <put_str_proc@plt>
xor    %eax,%eax
call   1050 <put_dec_proc@plt>
lea    0xeba(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\09END main\0A\00"
define void @end_program() {
%1 = call i32 (...) @put_str_proc()
%2 = call i32 (...) @put_dec_proc()
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [10 x i8] c"\09END main\00"
define void @end_program() {
%1 = tail call i32 (...) @put_str_proc()
%2 = tail call i32 (...) @put_dec_proc()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double fmin(double, double);
double my_fmin(double a, double b) { return fmin(a, b); }


x86 assembly (clang, -O0):
<my_fmin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm3
movsd  -0x10(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_fmin>:
movapd %xmm0,%xmm2
cmpunordsd %xmm0,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm1,%xmm3
minsd  %xmm0,%xmm1
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @my_fmin(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @llvm.minnum.f64(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @my_fmin(double %0, double %1) {
%3 = tail call double @llvm.minnum.f64(double %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void usage(const char *progname) {
  const char *optionsmsg = "  -s\ttest sequence numbers\n"
                           "  -t\trun trials\n"
                           "  -h\tshow this usage message\n";
  fprintf(stderr, "Usage: %s [OPTION] maxvalue nofelements\n%s", progname,
          optionsmsg);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xf0a(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xf26(%rip),%rsi
lea    0xed6(%rip),%rcx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [73 x i8] c" -s\09test sequence numbers\0A -t\09run trials\0A -h\09show this usage message\0A\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"Usage: %s [OPTION] maxvalue nofelements\0A%s\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [73 x i8] c" -s\09test sequence numbers\0A -t\09run trials\0A -h\09show this usage message\0A\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"Usage: %s [OPTION] maxvalue nofelements\0A%s\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}
void __attribute__((__no__)) load_fpr(float *a, float *b) {
  float c = *a;
  __asm__("# fpr, reg = %0" : "+d"(c));
  *b = c;
}


x86 assembly (clang, -O0):
<load_fpr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%edx
movd   %edx,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_fpr>:
mov    (%rdi),%edx
mov    %edx,(%rsi)
ret

LLVM IR (-O0):
define void @load_fpr(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = load float, float* %6
store float %7, float* %5
%8 = load float, float* %5
%9 = call float asm "# fpr, reg = $0", "={dx},0,~{dirflag},~{fpsr},~{flags}"(float %8)
store float %9, float* %5
%10 = load float, float* %5
%11 = load float*, float** %4
store float %10, float* %11
ret void
}

LLVM IR (-O2):
define void @load_fpr(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
%4 = tail call float asm "# fpr, reg = $0", "={dx},0,~{dirflag},~{fpsr},~{flags}"(float %3)
store float %4, float* %1
ret void
}
int f(int a, int b, int c) {
  a -= (b >> 16) * (c >> 16);
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
sar    $0x10,%ecx
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
imul   %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
sar    $0x10,%esi
sar    $0x10,%edx
imul   %esi,%edx
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = ashr i32 %7, 16
%9 = load i32, i32* %6
%10 = ashr i32 %9, 16
%11 = mul nsw i32 %8, %10
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, %11
store i32 %13, i32* %4
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = ashr i32 %1, 16
%5 = ashr i32 %2, 16
%6 = mul nsw i32 %5, %4
%7 = sub nsw i32 %0, %6
ret i32 %7
}
void mips_case(int i, unsigned tar, unsigned arg1, unsigned arg2) {}


x86 assembly (clang, -O0):
<mips_case>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_case>:
ret

LLVM IR (-O0):
define void @mips_case(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
ret void
}

LLVM IR (-O2):
define void @mips_case(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
void *clearReplicationId2(void) { return (void *)0; }


x86 assembly (clang, -O0):
<clearReplicationId2>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearReplicationId2>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @clearReplicationId2() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @clearReplicationId2() {
ret i8* null
}
int Cyc_Port_hash_seg_t(unsigned loc) {
  unsigned _T0;
  int _T1;
  _T0 = loc;
  _T1 = (int)_T0;
  return _T1;
}


x86 assembly (clang, -O0):
<Cyc_Port_hash_seg_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Port_hash_seg_t>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @Cyc_Port_hash_seg_t(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = load i32, i32* %3
store i32 %6, i32* %4
%7 = load i32, i32* %4
ret i32 %7
}

LLVM IR (-O2):
define i32 @Cyc_Port_hash_seg_t(i32 returned %0) {
ret i32 %0
}
int main(void) {
  int a = 0;
  unsigned b = (a * 64 & 192) | 63U;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x6,%eax
and    $0xc0,%eax
or     $0x3f,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 64
%6 = and i32 %5, 192
%7 = or i32 %6, 63
store i32 %7, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_usage(const char *name, bool moreinformation) {
  printf("Usage: %s [OPTION]... COMMAND\n", name);
  if (moreinformation)
    printf("Try '%s -h' for more inforamtion\n", name);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     1149 <print_usage+0x39>
mov    -0x8(%rbp),%rsi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
test   %ebp,%ebp
je     1140 <print_usage+0x30>
lea    0xeed(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Usage: %s [OPTION]... COMMAND\0A\00"
@.str.1 = [34 x i8] c"Try '%s -h' for more inforamtion\0A\00"
define void @print_usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: %s [OPTION]... COMMAND\0A\00"
@.str.1 = [34 x i8] c"Try '%s -h' for more inforamtion\0A\00"
define void @print_usage(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  FILE *fp;
  char cadena[] = "Mostrando el uso de fputs en un fichero.\n";
  fp = fopen("fichero.txt", "r+");
  fputs(cadena, fp);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x2a,%edx
call   1050 <memcpy@plt>
lea    0xeb8(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xede(%rip),%xmm0
movups %xmm0,0x1a(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xecb(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.cadena = [42 x i8] c"Mostrando el uso de fputs en un fichero.\0A\00"
@.str = [12 x i8] c"fichero.txt\00"
@.str.1 = [3 x i8] c"r+\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [42 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [42 x i8]* %7 to i8*
%9 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %6
%10 = getelementptr inbounds [42 x i8], [42 x i8]* %7, i64 0, i64 0
%11 = load i32*, i32** %6
%12 = call i32 @fputs(i8* %10, i32* %11)
%13 = load i32*, i32** %6
%14 = call i32 @fclose(i32* %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.cadena = [42 x i8] c"Mostrando el uso de fputs en un fichero.\0A\00"
@.str = [12 x i8] c"fichero.txt\00"
@.str.1 = [3 x i8] c"r+\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [42 x i8]
%4 = getelementptr inbounds [42 x i8], [42 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @fputs(i8* %4, i32* %5)
%7 = tail call i32 @fclose(i32* %5)
ret i32 0
}
unsigned bitarithm_lsb(unsigned v) {
  unsigned r = 0;
  while ((v & 1) == 0) {
    v >>= 1;
    r++;
  }
  return r;
}


x86 assembly (clang, -O0):
<bitarithm_lsb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1134 <bitarithm_lsb+0x34>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <bitarithm_lsb+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitarithm_lsb>:
xor    %eax,%eax
test   $0x1,%dil
jne    111d <bitarithm_lsb+0x1d>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax)
shr    %ecx
add    $0x1,%eax
test   $0x2,%dil
mov    %ecx,%edi
je     1110 <bitarithm_lsb+0x10>
ret

LLVM IR (-O0):
define i32 @bitarithm_lsb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i32, i32* %2
%10 = lshr i32 %9, 1
store i32 %10, i32* %2
%11 = load i32, i32* %3
%12 = add i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @bitarithm_lsb(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32 [ %7, %4 ], [ %0, %1 ]
%7 = lshr i32 %6, 1
%8 = add i32 %5, 1
%9 = and i32 %6, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
sig() { fatal("Fatal signal"); }


x86 assembly (clang, -O0):
<sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <fatal@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig>:
lea    0xee9(%rip),%rdi
jmp    1030 <fatal@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Fatal signal\00"
define i32 @sig() {
%1 = alloca i32
%2 = call i32 @fatal(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [13 x i8] c"Fatal signal\00"
define i32 @sig() {
%1 = tail call i32 @fatal(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int main(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t align_up(uint32_t value, uint32_t align) {
  if (value % align)
    value += align - (value % align);
  return value;
}


x86 assembly (clang, -O0):
<align_up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     1132 <align_up+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    %edx,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_up>:
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%esi
test   %edx,%edx
cmove  %edx,%esi
lea    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @align_up(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = srem i32 %5, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = srem i32 %11, %12
%14 = sub nsw i32 %10, %13
%15 = load i32, i32* %3
%16 = add nsw i32 %15, %14
store i32 %16, i32* %3
br label %17
17: ; preds = %9, %2
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @align_up(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
%5 = sub nsw i32 %1, %3
%6 = select i1 %4, i32 0, i32 %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int sum(int *, int *);
int main(void) {
  int val1 = 100;
  int val2 = 200;
  int res = sum(&val1, &val2);
  printf("Result is: %d\n", res);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
movl   $0xc8,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <sum@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x64,0x4(%rsp)
movl   $0xc8,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <sum@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Result is: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 100, i32* %2
store i32 200, i32* %3
%5 = call i32 @sum(i32* %2, i32* %3)
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@.str = [15 x i8] c"Result is: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 100, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 200, i32* %2
%5 = call i32 @sum(i32* %1, i32* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ PARENB;
int open_serial_and_set_cflags(char const *, int, int /*<<< orphan*/);
int open_serial_even_parity(const char *device, int rate) {
  return open_serial_and_set_cflags(device, rate, PARENB);
}


x86 assembly (clang, -O0):
<open_serial_even_parity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
call   1030 <open_serial_and_set_cflags@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_serial_even_parity>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <open_serial_and_set_cflags@plt>

LLVM IR (-O0):
@PARENB = global i32 0
define i32 @open_serial_even_parity(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = load i32, i32* @PARENB
%8 = call i32 @open_serial_and_set_cflags(i8* %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@PARENB = global i32 0
define i32 @open_serial_even_parity(i8* %0, i32 %1) {
%3 = load i32, i32* @PARENB
%4 = tail call i32 @open_serial_and_set_cflags(i8* %0, i32 %1, i32 %3)
ret i32 %4
}
unsigned int defaultCmp(void *data1, void *data2) { return data1 == data2; }


x86 assembly (clang, -O0):
<defaultCmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<defaultCmp>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @defaultCmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @defaultCmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void subsys_network_shutdown(void) { ; }


x86 assembly (clang, -O0):
<subsys_network_shutdown>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subsys_network_shutdown>:
ret

LLVM IR (-O0):
define void @subsys_network_shutdown() {
ret void
}

LLVM IR (-O2):
define void @subsys_network_shutdown() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_file;

/* Variables and functions */
int SQLITE_READONLY;
int memShmLock(sqlite3_file *pFile, int offset, int n, int flags) {
  return SQLITE_READONLY;
}


x86 assembly (clang, -O0):
<memShmLock>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0x2ed0(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memShmLock>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@SQLITE_READONLY = global i32 0
define i32 @memShmLock(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* @SQLITE_READONLY
ret i32 %9
}

LLVM IR (-O2):
@SQLITE_READONLY = global i32 0
define i32 @memShmLock(i32* nocapture readnone %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @SQLITE_READONLY
ret i32 %5
}
float v_float_func() { return (0.0); }


x86 assembly (clang, -O0):
<v_float_func>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_float_func>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @v_float_func() {
ret float 0.000000e+00
}

LLVM IR (-O2):
define float @v_float_func() {
ret float 0.000000e+00
}
int main() {
  int a;
  char *ch = (char *)&a;
  ch += 3;
  while (1) {
    *ch = *ch + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    111f <main+0x1f>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 3
store i8* %6, i8** %3
br label %7
7: ; preds = %0, %7
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, 1
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %3
store i8 %12, i8* %13
br label %7
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
scalar_t__ isspace(char const);
char *xskip_spaces(const char *str) {
  while (isspace(*str))
    ++str;
  return (char *)str;
}


x86 assembly (clang, -O0):
<xskip_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <xskip_spaces+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <xskip_spaces+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xskip_spaces>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <xskip_spaces+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xskip_spaces(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i64 @isspace(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define i8* @xskip_spaces(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
void switch_on_bits(unsigned char *data, unsigned char bits_on) {
  *data |= bits_on;
}


x86 assembly (clang, -O0):
<switch_on_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
or     %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<switch_on_bits>:
or     %sil,(%rdi)
ret

LLVM IR (-O0):
define void @switch_on_bits(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = or i32 %9, %6
%11 = trunc i32 %10 to i8
store i8 %11, i8* %7
ret void
}

LLVM IR (-O2):
define void @switch_on_bits(i8* nocapture %0, i8 zeroext %1) {
%3 = load i8, i8* %0
%4 = or i8 %3, %1
store i8 %4, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ td_thragent_t;
typedef int /*<<< orphan*/ td_err_e;

/* Variables and functions */
int /*<<< orphan*/ TD_OK;
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
td_err_e td_ta_delete(td_thragent_t *ta) {
  free(ta);
  return TD_OK;
}


x86 assembly (clang, -O0):
<td_ta_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<td_ta_delete>:
push   %rax
call   1030 <free@plt>
mov    0x2ec3(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@TD_OK = global i32 0
define i32 @td_ta_delete(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @free(i32* %3)
%5 = load i32, i32* @TD_OK
ret i32 %5
}

LLVM IR (-O2):
@TD_OK = global i32 0
define i32 @td_ta_delete(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
%3 = load i32, i32* @TD_OK
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ get_last_boss_ptn_fg();
int /*<<< orphan*/ set_map_total_last_boss(int /*<<< orphan*/, long, long, long,
                                           long);
void set_map_total_last_boss_fg(long x, long y, long dx, long dy) {
  set_map_total_last_boss(get_last_boss_ptn_fg(), x, y, dx, dy);
}


x86 assembly (clang, -O0):
<set_map_total_last_boss_fg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1030 <get_last_boss_ptn_fg@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1040 <set_map_total_last_boss@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_map_total_last_boss_fg>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <get_last_boss_ptn_fg@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <set_map_total_last_boss@plt>

LLVM IR (-O0):
define void @set_map_total_last_boss_fg(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = call i32 (...) @get_last_boss_ptn_fg()
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i32 @set_map_total_last_boss(i32 %9, i64 %10, i64 %11, i64 %12, i64 %13)
ret void
}

LLVM IR (-O2):
define void @set_map_total_last_boss_fg(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i32 (...) @get_last_boss_ptn_fg()
%6 = tail call i32 @set_map_total_last_boss(i32 %5, i64 %0, i64 %1, i64 %2, i64 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void handler(int signo) {
  printf("Received signal - exit success\n");
  exit(1);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Received signal - exit success\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [31 x i8] c"Received signal - exit success\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}