xunge/DecIR huggingface dataset:
/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *, int);
main(void) {
  int c;
  int i = 0;
  while ((c = getchar()) != '\n') {
    i++;
  }
  printf("%d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     1157 <main+0x37>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    $0xa,%eax
jne    1130 <main+0x10>
lea    0xeba(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %7, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
br label %4
10: ; preds = %4
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 (...) @getchar()
%4 = icmp eq i32 %3, 10
%5 = add nuw nsw i32 %2, 1
br i1 %4, label %6, label %1
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
int low_sign_ext(int val, int len) {
  return (((val << 1) & ~(-1u << len)) | ((val >> (len - 1)) & 1));
}


x86 assembly (clang, -O0):
<low_sign_ext>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<low_sign_ext>:
mov    %esi,%ecx
lea    (%rdi,%rdi,1),%edx
mov    $0xffffffff,%eax
shl    %cl,%eax
add    $0xffffffff,%ecx
shr    %cl,%edi
not    %eax
and    %edx,%eax
and    $0x1,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @low_sign_ext(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 = shl i32 %5, 1
%7 = load i32, i32* %4
%8 = shl i32 -1, %7
%9 = xor i32 %8, -1
%10 = and i32 %6, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = ashr i32 %11, %13
%15 = and i32 %14, 1
%16 = or i32 %10, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @low_sign_ext(i32 %0, i32 %1) {
%3 = shl i32 %0, 1
%4 = shl nsw i32 -1, %1
%5 = xor i32 %4, -1
%6 = and i32 %3, %5
%7 = add nsw i32 %1, -1
%8 = lshr i32 %0, %7
%9 = and i32 %8, 1
%10 = or i32 %9, %6
ret i32 %10
}
unsigned int f(unsigned int right, unsigned int key) {
  right += key;
  return (right);
}


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

x86 assembly (clang, -O2):
<f>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = add i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_proplist_iterate() {
  printf("NOT IMPLEMENTED:"
         "pa_proplist_iterate"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"NOT IMPLEMENTED:pa_proplist_iterate\0A\00"
define i32 @pa_proplist_iterate() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [36 x i8] c"NOT IMPLEMENTED:pa_proplist_iterate\00"
define i32 @pa_proplist_iterate() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int dir_deg(int d) {
  switch (d) {
  case 0:
    return (0);
  case 1:
    return (45);
  case 2:
    return (90);
  case 3:
    return (135);
  case 4:
    return (180);
  case 5:
    return (225);
  case 6:
    return (270);
  case 7:
    return (315);
  default:
    return (-1);
  }
}


x86 assembly (clang, -O0):
<dir_deg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     118c <dir_deg+0x8c>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0x2d,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0x5a,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0x87,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0xb4,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0xe1,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0x10e,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0x13b,-0x4(%rbp)
jmp    1193 <dir_deg+0x93>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_deg>:
cmp    $0x8,%edi
lea    (%rdi,%rdi,8),%eax
lea    (%rax,%rax,4),%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @dir_deg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %13 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
]
5: ; preds = %1
store i32 0, i32* %2
br label %14
6: ; preds = %1
store i32 45, i32* %2
br label %14
7: ; preds = %1
store i32 90, i32* %2
br label %14
8: ; preds = %1
store i32 135, i32* %2
br label %14
9: ; preds = %1
store i32 180, i32* %2
br label %14
10: ; preds = %1
store i32 225, i32* %2
br label %14
11: ; preds = %1
store i32 270, i32* %2
br label %14
12: ; preds = %1
store i32 315, i32* %2
br label %14
13: ; preds = %1
store i32 -1, i32* %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @dir_deg(i32 %0) {
%2 = icmp ult i32 %0, 8
%3 = mul i32 %0, 45
%4 = select i1 %2, i32 %3, i32 -1
ret i32 %4
}
/* Variables and functions */
int rustsecp256k1_v0_3_1_selftest_sha256();
int rustsecp256k1_v0_3_1_selftest(void) {
  return rustsecp256k1_v0_3_1_selftest_sha256();
}


x86 assembly (clang, -O0):
<rustsecp256k1_v0_3_1_selftest>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rustsecp256k1_v0_3_1_selftest_sha256@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rustsecp256k1_v0_3_1_selftest>:
xor    %eax,%eax
jmp    1030 <rustsecp256k1_v0_3_1_selftest_sha256@plt>

LLVM IR (-O0):
define i32 @rustsecp256k1_v0_3_1_selftest() {
%1 = call i32 (...) @rustsecp256k1_v0_3_1_selftest_sha256()
ret i32 %1
}

LLVM IR (-O2):
define i32 @rustsecp256k1_v0_3_1_selftest() {
%1 = tail call i32 (...) @rustsecp256k1_v0_3_1_selftest_sha256()
ret i32 %1
}
/* Variables and functions */
int is_upper(char);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", ('A' >= 'A' && 'A' <= 'Z') ? 1 : 0);
  printf("%d\n", ('g' >= 'A' && 'g' <= 'Z') ? 1 : 0);
  printf("%d\n", is_upper('A'));
  printf("%d\n", is_upper('g'));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x41,%edi
call   1040 <is_upper@plt>
mov    %eax,%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x67,%edi
call   1040 <is_upper@plt>
mov    %eax,%esi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x41,%edi
call   1040 <is_upper@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x67,%edi
call   1040 <is_upper@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = call i32 @is_upper(i8 signext 65)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @is_upper(i8 signext 103)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = tail call i32 @is_upper(i8 signext 65)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @is_upper(i8 signext 103)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
char *str_plast(char const *, char const *);
long str_last(const char *in, const char *what) {
  char *found = str_plast(in, what);
  return found ? found - in : -1;
}


x86 assembly (clang, -O0):
<str_last>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <str_plast@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1150 <str_last+0x40>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1160 <str_last+0x50>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1160 <str_last+0x50>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_last>:
push   %rbx
mov    %rdi,%rbx
call   1030 <str_plast@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
cmp    $0x1,%rax
sbb    %rax,%rax
or     %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @str_last(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @str_plast(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
br label %18
17: ; preds = %2
br label %18
18: ; preds = %17, %11
%19 = phi i64 [ %16, %11 ], [ -1, %17 ]
ret i64 %19
}

LLVM IR (-O2):
define i64 @str_last(i8* %0, i8* %1) {
%3 = tail call i8* @str_plast(i8* %0, i8* %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = select i1 %4, i64 -1, i64 %7
ret i64 %8
}
int wpas_p2p_4way_hs_failed(struct wpa_supplicant *wpa_s) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define i32 @wpas_p2p_4way_hs_failed(%struct.wpa_supplicant* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
float ANTweenTimingFunctionSineOut(float, int /*<<< orphan*/, int, float);
float ANTweenProgressTimingFunctionSineOut(float time, float duration) {
  return ANTweenTimingFunctionSineOut(time, 0, 1, duration);
}


x86 assembly (clang, -O0):
<ANTweenProgressTimingFunctionSineOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <ANTweenTimingFunctionSineOut@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ANTweenProgressTimingFunctionSineOut>:
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <ANTweenTimingFunctionSineOut@plt>

LLVM IR (-O0):
define float @ANTweenProgressTimingFunctionSineOut(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @ANTweenTimingFunctionSineOut(float %5, i32 0, i32 1, float %6)
ret float %7
}

LLVM IR (-O2):
define float @ANTweenProgressTimingFunctionSineOut(float %0, float %1) {
%3 = tail call float @ANTweenTimingFunctionSineOut(float %0, i32 0, i32 1, float %1)
ret float %3
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_REQ;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_REQ_it;
void X509_REQ_free(X509_REQ *a) {
  ASN1_item_free((ASN1_VALUE *)a, &X509_REQ_it);
}


x86 assembly (clang, -O0):
<X509_REQ_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ed1(%rip),%rsi
call   1030 <ASN1_item_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_REQ_free>:
mov    0x2ee1(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

LLVM IR (-O0):
@X509_REQ_it = global i32 0
define void @X509_REQ_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @ASN1_item_free(i32* %3, i32* @X509_REQ_it)
ret void
}

LLVM IR (-O2):
@X509_REQ_it = global i32 0
define void @X509_REQ_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @X509_REQ_it)
ret void
}
/* Type definitions */
typedef scalar_t__ __u32;

/* Variables and functions */
__u32 max(__u32 a, __u32 b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <max+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <max+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @max(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @max(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int f2(int a, int b, int c) {
  return ((((a) < (b) ? a : b)) < (c) ? ((a) < (b) ? a : b) : c);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <f2+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112a <f2+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115e <f2+0x5e>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114d <f2+0x4d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <f2+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <f2+0x64>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
cmp    %edx,%eax
cmovge %edx,%eax
ret

LLVM IR (-O0):
define i32 @f2(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* %4
%8 = load i32, i32* %5
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32, i32* %4
br label %14
12: ; preds = %3
%13 = load i32, i32* %5
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ %11, %10 ], [ %13, %12 ]
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32, i32* %4
br label %26
24: ; preds = %18
%25 = load i32, i32* %5
br label %26
26: ; preds = %24, %22
%27 = phi i32 [ %23, %22 ], [ %25, %24 ]
br label %30
28: ; preds = %14
%29 = load i32, i32* %6
br label %30
30: ; preds = %28, %26
%31 = phi i32 [ %27, %26 ], [ %29, %28 ]
ret i32 %31
}

LLVM IR (-O2):
define i32 @f2(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %0, i32 %1
%6 = icmp slt i32 %5, %2
%7 = select i1 %6, i32 %5, i32 %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ bbswitch_write(char *);
void bbswitch_off(void) { bbswitch_write("OFF\n"); }


x86 assembly (clang, -O0):
<bbswitch_off>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <bbswitch_write@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"OFF\0A\00"
define void @bbswitch_off() {
%1 = call i32 @bbswitch_write(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"OFF\0A\00"
define void @bbswitch_off() {
%1 = tail call i32 @bbswitch_write(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
int tty_issofttab(void) {}


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

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

LLVM IR (-O0):
define i32 @tty_issofttab() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @tty_issofttab() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ exit(int);
int fgetc(int /*<<< orphan*/ *);
scalar_t__ putchar(int);
void do_cat(FILE *f) {
  int c;
  while ((c = fgetc(f)) != EOF) {
    if (putchar(c) < 0)
      exit(1);
  }
}


x86 assembly (clang, -O0):
<do_cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%eax
je     1178 <do_cat+0x48>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
cmp    $0x0,%rax
jge    1173 <do_cat+0x43>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    113c <do_cat+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cat>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eaa(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r14),%eax
je     1163 <do_cat+0x33>
mov    %eax,%edi
call   1030 <putchar@plt>
test   %rax,%rax
jns    1140 <do_cat+0x10>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @do_cat(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %15, %1
%5 = load i32*, i32** %2
%6 = call i32 @fgetc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i64 @putchar(i32 %10)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %9
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @do_cat(i32* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call i64 @putchar(i32 %3)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %2
9: ; preds = %6
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void write_word(int fd, int word) {
  int i;
  char temp;
  for (i = 0; i < 4; i++) {
    temp = (word >> (i * 8)) & 0xFF;
    write(fd, &temp, sizeof(char));
  }
}


x86 assembly (clang, -O0):
<write_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1161 <write_word+0x51>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xd(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <write_word+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_word>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %bl,0xf(%rsp)
lea    0xf(%rsp),%r14
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %bh,0xf(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebx,%eax
shr    $0x10,%eax
mov    %al,0xf(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
shr    $0x18,%ebx
mov    %bl,0xf(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @write_word(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = mul nsw i32 %12, 8
%14 = ashr i32 %11, %13
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
store i8 %16, i8* %6
%17 = load i32, i32* %3
%18 = call i32 @write(i32 %17, i8* %6, i32 1)
br label %19
19: ; preds = %10
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @write_word(i32 %0, i32 %1) {
%3 = alloca i8
%4 = trunc i32 %1 to i8
store i8 %4, i8* %3
%5 = call i32 @write(i32 %0, i8* %3, i32 1)
%6 = lshr i32 %1, 8
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = call i32 @write(i32 %0, i8* %3, i32 1)
%9 = lshr i32 %1, 16
%10 = trunc i32 %9 to i8
store i8 %10, i8* %3
%11 = call i32 @write(i32 %0, i8* %3, i32 1)
%12 = lshr i32 %1, 24
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
%14 = call i32 @write(i32 %0, i8* %3, i32 1)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
uint8_t tms_byte_reverse(uint8_t a) {
  uint8_t b = 0;
  int32_t i;
  for (i = 0; i < 8; i++) {
    b = (b << 1) | (a & 0x01);
    a = a >> 1;
  }
  return b;
}


x86 assembly (clang, -O0):
<tms_byte_reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1147 <tms_byte_reverse+0x47>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <tms_byte_reverse+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tms_byte_reverse>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %al,%dil
mov    %edi,%eax
and    $0x55,%al
add    %al,%al
shr    %dil
and    $0x55,%dil
or     %al,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @tms_byte_reverse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %16, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %3
%10 = shl i32 %9, 1
%11 = load i32, i32* %2
%12 = and i32 %11, 1
%13 = or i32 %10, %12
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = ashr i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %8
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %5
19: ; preds = %5
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @tms_byte_reverse(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = call i8 @llvm.bitreverse.i8(i8 %2)
%4 = zext i8 %3 to i32
ret i32 %4
}
char *GetFileType(statBufPtr)
struct stat *statBufPtr;
{
  char *typeStr;
  if (0) {
    typeStr = "file";
  } else if (0) {
    typeStr = "directory";
  } else if (0) {
    typeStr = "characterSpecial";
  } else if (0) {
    typeStr = "blockSpecial";
  } else if (0) {
    typeStr = "fifo";
  } else if (0) {
    typeStr = "link";
  } else if (0) {
    typeStr = "socket";
  } else {
    typeStr = "unknown";
  }
  return typeStr;
}


x86 assembly (clang, -O0):
<GetFileType>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetFileType>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
%struct.stat = type opaque
@.str = [8 x i8] c"unknown\00"
define i8* @GetFileType(%struct.stat* %0) {
%2 = alloca %struct.stat*
%3 = alloca i8*
store %struct.stat* %0, %struct.stat** %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
ret i8* %4
}

LLVM IR (-O2):
%struct.stat = type opaque
@.str = [8 x i8] c"unknown\00"
define i8* @GetFileType(%struct.stat* nocapture readnone %0) {
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
}
int test_imm_85int16_reg(short val) {
  return ((val) & (0x85 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_85int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x85,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_85int16_reg>:
test   $0x85,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_85int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 133
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_85int16_reg(i16 signext %0) {
%2 = and i16 %0, 133
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ issafeneg(int);
int safeneg(int x) {
  if (!issafeneg(x)) {
    error("safeneg");
  }
  return -x;
}


x86 assembly (clang, -O0):
<safeneg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <issafeneg@plt>
cmp    $0x0,%eax
jne    1148 <safeneg+0x28>
lea    0xebd(%rip),%rdi
call   1030 <error@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safeneg>:
push   %rbx
mov    %edi,%ebx
call   1040 <issafeneg@plt>
test   %eax,%eax
jne    1138 <safeneg+0x18>
lea    0xecd(%rip),%rdi
call   1030 <error@plt>
neg    %ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"safeneg\00"
define i32 @safeneg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @issafeneg(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = sub nsw i32 0, %9
ret i32 %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"safeneg\00"
define i32 @safeneg(i32 %0) {
%2 = tail call i32 @issafeneg(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = sub nsw i32 0, %0
ret i32 %7
}
int perimetrocircunferencia(int r) {
  int perimetro;
  int d;
  d = r * 2;
  perimetro = 3.141592654 * d;
  return perimetro;
}


x86 assembly (clang, -O0):
<perimetrocircunferencia>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xee3(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<perimetrocircunferencia>:
add    %edi,%edi
cvtsi2sd %edi,%xmm0
mulsd  0xef2(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @perimetrocircunferencia(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 2
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = fmul double 0x400921FB54524550, %8
%10 = fptosi double %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @perimetrocircunferencia(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = sitofp i32 %2 to double
%4 = fmul double %3, 0x400921FB54524550
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ info(char *, char const *);
__attribute__((visibility("default"))) void run_test(const char *test_desc,
                                                     void (*test_func)(void)) {
  info("Running %s", test_desc);
  test_func();
}


x86 assembly (clang, -O0):
<run_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <info@plt>
call   *-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_test>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
call   1030 <info@plt>
mov    %rbx,%rax
pop    %rbx
jmp    *%rax

LLVM IR (-O0):
@.str = [11 x i8] c"Running %s\00"
define void @run_test(i8* %0, void ()* %1) {
%3 = alloca i8*
%4 = alloca void ()*
store i8* %0, i8** %3
store void ()* %1, void ()** %4
%5 = load i8*, i8** %3
%6 = call i32 @info(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load void ()*, void ()** %4
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Running %s\00"
define void @run_test(i8* %0, void ()* nocapture %1) {
%3 = tail call i32 @info(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
tail call void %1()
ret void
}
void foo(char *p) {
  volatile int zero = 0;
  __builtin_memcpy(p, "abc", zero);
  p[0] = 'd';
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
movslq %eax,%rdx
lea    0xecc(%rip),%rsi
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
movb   $0x64,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
movslq 0xc(%rsp),%rdx
lea    0xed4(%rip),%rsi
call   1030 <memcpy@plt>
movb   $0x64,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
define void @foo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store volatile i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = load volatile i32, i32* %3
%6 = sext i32 %5 to i64
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 100, i8* %8
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define void @foo(i8* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store volatile i32 0, i32* %2
%4 = load volatile i32, i32* %2
%5 = sext i32 %4 to i64
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %5, i1 false)
store i8 100, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo3();
void test2() { foo3(); }


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <foo3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
xor    %eax,%eax
jmp    1030 <foo3@plt>

LLVM IR (-O0):
define void @test2() {
%1 = call i32 (...) @foo3()
ret void
}

LLVM IR (-O2):
define void @test2() {
%1 = tail call i32 (...) @foo3()
ret void
}
int main(void) { return __builtin_expect(1, 1) ? 1 : 0; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ disp_str(char *);
int /*<<< orphan*/ milli_delay(int);
void TestC() {
  int i = 0x2000;
  while (1) {
    disp_str("C.");
    milli_delay(1500);
  }
}


x86 assembly (clang, -O0):
<TestC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2000,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <disp_str@plt>
mov    $0x5dc,%edi
call   1040 <milli_delay@plt>
jmp    112f <TestC+0xf>

x86 assembly (clang, -O2):
<TestC>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <disp_str@plt>
mov    $0x5dc,%edi
call   1040 <milli_delay@plt>
jmp    1130 <TestC+0x10>

LLVM IR (-O0):
@.str = [3 x i8] c"C.\00"
define void @TestC() {
%1 = alloca i32
store i32 8192, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 @disp_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @milli_delay(i32 1500)
br label %2
}

LLVM IR (-O2):
@.str = [3 x i8] c"C.\00"
define void @TestC() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @disp_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @milli_delay(i32 1500)
br label %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void decode_tuple(uint32_t tuple, int count) {
  int i;
  for (i = 1; i < count; i++) {
    putchar(tuple >> ((4 - i) * 8));
  }
}


x86 assembly (clang, -O0):
<decode_tuple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1154 <decode_tuple+0x44>
mov    -0x4(%rbp),%edi
mov    $0x4,%ecx
sub    -0xc(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <decode_tuple+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_tuple>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1144 <decode_tuple+0x34>
mov    %esi,%ebx
mov    %edi,%r14d
add    $0xffffffff,%ebx
mov    $0x18,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %ebp,%ecx
sar    %cl,%edi
call   1030 <putchar@plt>
add    $0xfffffff8,%ebp
add    $0xffffffff,%ebx
jne    1130 <decode_tuple+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @decode_tuple(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ 1, %2 ]
%6 = mul i32 %5, -8
%7 = add i32 %6, 32
%8 = ashr i32 %0, %7
%9 = tail call i32 @putchar(i32 %8)
%10 = add nuw nsw i32 %5, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
void call_after_alloca(c, s, i, l) char c;
short s;
int i;
long l;
{
  char *z = __builtin_alloca(s + 50);
  call_after_alloca_subr(c, s, i, l, 'b', 11, 12, (unsigned long)13);
}


x86 assembly (clang, -O0):
<call_after_alloca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    %rcx,-0x10(%rbp)
movswq -0x4(%rbp),%rcx
add    $0x41,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
mov    %rax,-0x18(%rbp)
movsbl -0x1(%rbp),%edi
movswl -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x62,%r8d
mov    $0xb,%r9d
sub    $0x10,%rsp
movl   $0xc,(%rsp)
movq   $0xd,0x8(%rsp)
mov    $0x0,%al
call   1030 <call_after_alloca_subr@plt>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_after_alloca>:
push   %rax
movswl %si,%esi
movsbl %dil,%edi
mov    $0x62,%r8d
mov    $0xb,%r9d
xor    %eax,%eax
push   $0xd
push   $0xc
call   1030 <call_after_alloca_subr@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @call_after_alloca(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i8
%6 = alloca i16
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
%10 = trunc i32 %0 to i8
%11 = trunc i32 %1 to i16
store i8 %10, i8* %5
store i16 %11, i16* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%12 = load i16, i16* %6
%13 = sext i16 %12 to i32
%14 = add nsw i32 %13, 50
%15 = sext i32 %14 to i64
%16 = alloca i8, i64 %15
store i8* %16, i8** %9
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = load i16, i16* %6
%20 = sext i16 %19 to i32
%21 = load i32, i32* %7
%22 = load i64, i64* %8
%23 = call i32 (i32, i32, i32, i64, i32, i32, i32, i64, ...) bitcast (i32 (...)* @call_after_alloca_subr to i32 (i32, i32, i32, i64, i32, i32, i32, i64, ...)*)(i32 %18, i32 %20, i32 %21, i64 %22, i32 98, i32 11, i32 12, i64 13)
ret void
}

LLVM IR (-O2):
define void @call_after_alloca(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = shl i32 %1, 16
%6 = ashr exact i32 %5, 16
%7 = shl i32 %0, 24
%8 = ashr exact i32 %7, 24
%9 = tail call i32 (i32, i32, i32, i64, i32, i32, i32, i64, ...) bitcast (i32 (...)* @call_after_alloca_subr to i32 (i32, i32, i32, i64, i32, i32, i32, i64, ...)*)(i32 %8, i32 %6, i32 %2, i64 %3, i32 98, i32 11, i32 12, i64 13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lockf(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
main() { lockf(0, 0, 0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <lockf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <lockf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @lockf(i32 0, i32 0, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @lockf(i32 0, i32 0, i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ENGINE;

/* Variables and functions */
int rsa_init(ENGINE *e) { return 1; }


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

x86 assembly (clang, -O2):
<rsa_init>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @rsa_init(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
ret i32 1
}

LLVM IR (-O2):
define i32 @rsa_init(i32* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void defOnUserInfo(char *userInfo, int len) {
  printf("defOnUserInfo %s\n", userInfo);
}


x86 assembly (clang, -O0):
<defOnUserInfo>:
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>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<defOnUserInfo>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"defOnUserInfo %s\0A\00"
define void @defOnUserInfo(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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"defOnUserInfo %s\0A\00"
define void @defOnUserInfo(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
double fisProduct(double x, double y) { return (x * y); }


x86 assembly (clang, -O0):
<fisProduct>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fisProduct>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fisProduct(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 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @fisProduct(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse(char *);
int main() {
  char str[] = "Hello C";
  printf("%s\n", str);
  reverse(str);
  printf("%s\n", str);
  int z = 10 + 20;
  printf("%d\n", z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0xc(%rbp),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1e,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x43206f6c6c6548,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe98(%rip),%rdi
mov    $0x1e,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [8 x i8] c"Hello C\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i8]* %2 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%8 = call i32 @reverse(i8* %7)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 30, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 18894486372115784, i64* %1
%3 = call i32 @puts(i8* %2)
%4 = call i32 @reverse(i8* %2)
%5 = call i32 @puts(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 30)
ret i32 0
}
/* Variables and functions */
int hDoubleToLongBits(double);
int hIsInf(double d) {
  return (hDoubleToLongBits(d) & 0x7fffffffffffffffll) == 0x7ff0000000000000ll;
}


x86 assembly (clang, -O0):
<hIsInf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <hDoubleToLongBits@plt>
cltq
movabs $0x7fffffffffffffff,%rcx
ff ff 7f
and    %rcx,%rax
movabs $0x7ff0000000000000,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hIsInf>:
push   %rax
call   1030 <hDoubleToLongBits@plt>
cltq
movabs $0x7fffffffffffffff,%rcx
ff ff 7f
and    %rax,%rcx
movabs $0x7ff0000000000000,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hIsInf(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @hDoubleToLongBits(double %3)
%5 = sext i32 %4 to i64
%6 = and i64 %5, 9223372036854775807
%7 = icmp eq i64 %6, 9218868437227405312
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @hIsInf(double %0) {
%2 = tail call i32 @hDoubleToLongBits(double %0)
%3 = sext i32 %2 to i64
%4 = and i64 %3, 9223372036854775807
%5 = icmp eq i64 %4, 9218868437227405312
%6 = zext i1 %5 to i32
ret i32 %6
}
int is_bigendian(void) {
  int a = 1;
  return *(char *)&a == 0;
}


x86 assembly (clang, -O0):
<is_bigendian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movsbl -0x4(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_bigendian() {
ret i32 0
}