xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
char *setbpath(char *buf, const char *boardname) {
  strcpy(buf, "boards/");
  strcat(buf, boardname);
  return buf;
}


x86 assembly (clang, -O0):
<setbpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbpath>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"boards/\00"
define i8* @setbpath(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 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @strcat(i8* %7, i8* %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"boards/\00"
define i8* @setbpath(i8* returned %0, i8* %1) {
%3 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strcat(i8* %0, i8* %1)
ret i8* %0
}
short int cast_uint_short_fast(unsigned int x) { return (short int)x; }


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

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

LLVM IR (-O0):
define signext i16 @cast_uint_short_fast(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i16
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @cast_uint_short_fast(i32 %0) {
%2 = trunc i32 %0 to i16
ret i16 %2
}
void t8() { __complex__ int *x = &(__complex__ int){1}; }


x86 assembly (clang, -O0):
<t8>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @t8() {
%1 = alloca { i32, i32 }*
%2 = alloca { i32, i32 }
%3 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %2, i32 0, i32 0
%4 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %2, i32 0, i32 1
store i32 1, i32* %3
store i32 0, i32* %4
store { i32, i32 }* %2, { i32, i32 }** %1
ret void
}

LLVM IR (-O2):
define void @t8() {
ret void
}
float __glsl_sign(float x) {
  if (x > 0) {
    return 1.0;
  } else if (x == 0) {
    return 0.0;
  } else {
    return -1.0;
  }
}


x86 assembly (clang, -O0):
<__glsl_sign>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    112c <__glsl_sign+0x2c>
movss  0xee2(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <__glsl_sign+0x5d>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1150 <__glsl_sign+0x50>
jp     1150 <__glsl_sign+0x50>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <__glsl_sign+0x5d>
movss  0xea8(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__glsl_sign>:
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
cmpeqss %xmm1,%xmm2
movss  0xeed(%rip),%xmm3
andnps %xmm3,%xmm2
cmpltss %xmm0,%xmm1
movss  0xee1(%rip),%xmm0
andps  %xmm1,%xmm0
andnps %xmm2,%xmm1
orps   %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__glsl_sign(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp ogt float %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store float 1.000000e+00, float* %2
br label %12
7: ; preds = %1
%8 = load float, float* %3
%9 = fcmp oeq float %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store float 0.000000e+00, float* %2
br label %12
11: ; preds = %7
store float -1.000000e+00, float* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load float, float* %2
ret float %13
}

LLVM IR (-O2):
define float @__glsl_sign(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
%3 = fcmp oeq float %0, 0.000000e+00
%4 = select i1 %3, float 0.000000e+00, float -1.000000e+00
%5 = select i1 %2, float 1.000000e+00, float %4
ret float %5
}
int test_imm_C2uint8_mem(unsigned char *val) {
  return ((*val) & (-0xC2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C2uint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffff3e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C2uint8_mem>:
testb  $0x3e,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C2uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 62
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int string_to_number_l(char const *, unsigned int, unsigned int,
                       unsigned long *);
int string_to_number(const char *s, unsigned int min, unsigned int max,
                     unsigned int *ret) {
  int result;
  unsigned long number;
  result = string_to_number_l(s, min, max, &number);
  *ret = (unsigned int)number;
  return result;
}


x86 assembly (clang, -O0):
<string_to_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x28(%rbp),%rcx
call   1030 <string_to_number_l@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_to_number>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
lea    0x8(%rsp),%rcx
call   1030 <string_to_number_l@plt>
mov    0x8(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @string_to_number(i8* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i64
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @string_to_number_l(i8* %11, i32 %12, i32 %13, i64* %10)
store i32 %14, i32* %9
%15 = load i64, i64* %10
%16 = trunc i64 %15 to i32
%17 = load i32*, i32** %8
store i32 %16, i32* %17
%18 = load i32, i32* %9
ret i32 %18
}

LLVM IR (-O2):
define i32 @string_to_number(i8* %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
%7 = call i32 @string_to_number_l(i8* %0, i32 %1, i32 %2, i64* %5)
%8 = load i64, i64* %5
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *);
scalar_t__ fork();
int /*<<< orphan*/ perror(char *);
void cal_scad() {
  pid_t pid;
  if ((pid = fork()) < 0)
    perror("fork error");
  else if (pid == 0) {
    execl("/usr/local/bin/openscad", "./1.scad");
  }
}


x86 assembly (clang, -O0):
<cal_scad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <fork@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jge    115e <cal_scad+0x2e>
lea    0xeac(%rip),%rdi
call   1030 <perror@plt>
jmp    1181 <cal_scad+0x51>
cmpq   $0x0,-0x8(%rbp)
jne    117c <cal_scad+0x4c>
lea    0xe9b(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1040 <execl@plt>
jmp    1181 <cal_scad+0x51>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_scad>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
test   %rax,%rax
js     1155 <cal_scad+0x25>
je     1141 <cal_scad+0x11>
pop    %rax
ret
lea    0xec3(%rip),%rdi
lea    0xed4(%rip),%rsi
pop    %rax
jmp    1040 <execl@plt>
lea    0xea4(%rip),%rdi
pop    %rax
jmp    1030 <perror@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"fork error\00"
@.str.1 = [24 x i8] c"/usr/local/bin/openscad\00"
@.str.2 = [9 x i8] c"./1.scad\00"
define void @cal_scad() {
%1 = alloca i64
%2 = call i64 (...) @fork()
store i64 %2, i64* %1
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %12
6: ; preds = %0
%7 = load i64, i64* %1
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @execl(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
br label %12
12: ; preds = %11, %4
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"fork error\00"
@.str.1 = [24 x i8] c"/usr/local/bin/openscad\00"
@.str.2 = [9 x i8] c"./1.scad\00"
define void @cal_scad() {
%1 = tail call i64 (...) @fork()
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %9
5: ; preds = %0
%6 = icmp eq i64 %1, 0
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @execl(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %5, %7, %3
ret void
}
char *strcat(char *ret, register const char *s2) {
  register char *s1 = ret;
  while (*s1++ != '\0')
    ;
  s1--;
  while (*s1++ = *s2++)
    ;
  return ret;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1134 <strcat+0x34>
jmp    1114 <strcat+0x14>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     116f <strcat+0x6f>
jmp    1140 <strcat+0x40>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

LLVM IR (-O0):
define i8* @strcat(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
store i8* %6, i8** %5
br label %7
7: ; preds = %13, %2
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %5
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %7
br label %7
14: ; preds = %7
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 -1
store i8* %16, i8** %5
br label %17
17: ; preds = %24, %14
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
%20 = load i8, i8* %18
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %5
store i8 %20, i8* %21
%23 = icmp ne i8 %20, 0
br i1 %23, label %24, label %25
24: ; preds = %17
br label %17
25: ; preds = %17
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
void f5(unsigned char a, unsigned short b) {}


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f5(i8 zeroext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
ret void
}

LLVM IR (-O2):
define void @f5(i8 zeroext %0, i16 zeroext %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ boot();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello World\nWelcome to the CPU simulator\n");
  printf("Initializing virtual hardware...\n");
  boot();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <boot@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <boot@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Hello World\0AWelcome to the CPU simulator\0A\00"
@.str.1 = [34 x i8] c"Initializing virtual hardware...\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @boot()
ret i32 0
}

LLVM IR (-O2):
@str = [41 x i8] c"Hello World\0AWelcome to the CPU simulator\00"
@str.2 = [33 x i8] c"Initializing virtual hardware...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 (...) @boot()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int /*<<< orphan*/);
void print_value(const char *label, int32_t value) {
  printf("%-20s %ld\n", label, value);
}


x86 assembly (clang, -O0):
<print_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_value>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%-20s %ld\0A\00"
define void @print_value(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 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%-20s %ld\0A\00"
define void @print_value(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
int ft_nbrlen(int nbr) {
  int len;
  len = 1;
  while (nbr / 10 > 0) {
    len++;
    nbr /= 10;
  }
  return (len);
}


x86 assembly (clang, -O0):
<ft_nbrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jle    113e <ft_nbrlen+0x3e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <ft_nbrlen+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_nbrlen>:
mov    $0x1,%eax
cmp    $0xa,%edi
jl     1134 <ft_nbrlen+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <ft_nbrlen+0x20>
ret

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

LLVM IR (-O2):
define i32 @ft_nbrlen(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
char get_byte(char *addr) { return (*addr); }


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

x86 assembly (clang, -O2):
<get_byte>:
mov    (%rdi),%al
ret

LLVM IR (-O0):
define signext i8 @get_byte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @get_byte(i8* nocapture %0) {
%2 = load i8, i8* %0
ret i8 %2
}
/* Variables and functions */
char toupper(char);
void locale_ucase(char *s) {
  char *ptr = s;
  for (; *ptr != '\0'; ++ptr)
    *ptr = toupper(*ptr);
}


x86 assembly (clang, -O0):
<locale_ucase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1159 <locale_ucase+0x49>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <locale_ucase+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locale_ucase>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <locale_ucase+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <locale_ucase+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @locale_ucase(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %15, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = call signext i8 @toupper(i8 signext %12)
%14 = load i8*, i8** %3
store i8 %13, i8* %14
br label %15
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
br label %5
18: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @locale_ucase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @toupper(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
char *lindex(const char *s, const char *limit, int c) {
  while (s < limit)
    if (*s++ == c)
      return (char *)(s - 1);
  return 0;
}


x86 assembly (clang, -O0):
<lindex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114e <lindex+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    -0x1c(%rbp),%eax
jne    1149 <lindex+0x49>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <lindex+0x56>
jmp    110f <lindex+0xf>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lindex>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %rsi,%rdi
jae    1127 <lindex+0x27>
movsbl (%rdi),%ecx
add    $0x1,%rdi
cmp    %edx,%ecx
jne    1110 <lindex+0x10>
add    $0xffffffffffffffff,%rdi
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @lindex(i8* %0, i8* readnone %1, i32 %2) {
br label %4
4: ; preds = %7, %3
%5 = phi i8* [ %0, %3 ], [ %8, %7 ]
%6 = icmp ult i8* %5, %1
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, %2
br i1 %11, label %12, label %4
12: ; preds = %4, %7
%13 = phi i8* [ %5, %7 ], [ null, %4 ]
ret i8* %13
}
int chk_chr(const char *str, int chr) {
  while (*str && *str != chr)
    str++;
  return (*str);
}


x86 assembly (clang, -O0):
<chk_chr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     1130 <chk_chr+0x30>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    -0xc(%rbp),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1140 <chk_chr+0x40>
jmp    1151 <chk_chr+0x51>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110b <chk_chr+0xb>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_chr>:
movsbl (%rdi),%eax
test   %eax,%eax
je     110f <chk_chr+0xf>
add    $0x1,%rdi
cmp    %esi,%eax
jne    1100 <chk_chr>
ret

LLVM IR (-O0):
define i32 @chk_chr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %18, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i32, i32* %4
%15 = icmp ne i32 %13, %14
br label %16
16: ; preds = %10, %5
%17 = phi i1 [ false, %5 ], [ %15, %10 ]
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %5
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @chk_chr(i8* nocapture %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %10, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = sext i8 %5 to i32
%8 = icmp eq i32 %7, %1
%9 = or i1 %6, %8
%10 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %9, label %11, label %3
11: ; preds = %3
%12 = sext i8 %5 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ err(int /*<<< orphan*/, int /*<<< orphan*/ *);
void *malloc(size_t);
void *xmalloc(size_t n) {
  void *p;
  assert(n > 0);
  p = malloc(n);
  if (p == NULL)
    err(EXIT_FAILURE, NULL);
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1178 <xmalloc+0x48>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1162 <xmalloc+0x32>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <err@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ugt i64 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i64, i64* %2
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @err(i32 %13, i32* null)
br label %15
15: ; preds = %12, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define noalias i8* @xmalloc(i64 %0) {
%2 = icmp ne i64 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @malloc(i64 %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @err(i32 %8, i32* null)
br label %10
10: ; preds = %7, %1
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ cyclic_uninit();
void cyclic_machdep_uninit(void) { cyclic_uninit(); }


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

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

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

LLVM IR (-O2):
define void @cyclic_machdep_uninit() {
%1 = tail call i32 (...) @cyclic_uninit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doublesubcycle1();
void doublesubcycle3(void) { doublesubcycle1(); }


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

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

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

LLVM IR (-O2):
define void @doublesubcycle3() {
%1 = tail call i32 (...) @doublesubcycle1()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int ftruncate(int, int /*<<< orphan*/);
int txc_libc_ftruncate(int fd, off_t length) { return ftruncate(fd, length); }


x86 assembly (clang, -O0):
<txc_libc_ftruncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <ftruncate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txc_libc_ftruncate>:
jmp    1030 <ftruncate@plt>

LLVM IR (-O0):
define i32 @txc_libc_ftruncate(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 @ftruncate(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @txc_libc_ftruncate(i32 %0, i32 %1) {
%3 = tail call i32 @ftruncate(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ set_mode(int);
int f_v97(int mode, unsigned char **sec, float *data, unsigned int ndata,
          char *inv_out, void **local) {
  set_mode(97);
  return 0;
}


x86 assembly (clang, -O0):
<f_v97>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x61,%edi
call   1030 <set_mode@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_v97>:
push   %rax
mov    $0x61,%edi
call   1030 <set_mode@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f_v97(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca float*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8**
store i32 %0, i32* %7
store i8** %1, i8*** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8** %5, i8*** %12
%13 = call i32 @set_mode(i32 97)
ret i32 0
}

LLVM IR (-O2):
define i32 @f_v97(i32 %0, i8** nocapture readnone %1, float* nocapture readnone %2, i32 %3, i8* nocapture readnone %4, i8** nocapture readnone %5) {
%7 = tail call i32 @set_mode(i32 97)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
main(int argc, char *argv[]) {
  printf("hello, world\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello, world\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [13 x i8] c"hello, world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
scalar_t__ isdigit(char);
scalar_t__ isxdigit(char);
char tolower(char);
int hexToDec(char hex) {
  if (isdigit(hex))
    return (hex - '0');
  if (isxdigit(hex))
    return (tolower(hex) - 'a' + 10);
  return -1;
}


x86 assembly (clang, -O0):
<hexToDec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1160 <hexToDec+0x30>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <hexToDec+0x64>
movsbl -0x5(%rbp),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     118d <hexToDec+0x5d>
movsbl -0x5(%rbp),%edi
call   1040 <tolower@plt>
movsbl %al,%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <hexToDec+0x64>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexToDec>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
je     1145 <hexToDec+0x15>
movsbl %bl,%eax
add    $0xffffffd0,%eax
pop    %rbx
ret
movsbl %bl,%ebx
mov    %ebx,%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     1163 <hexToDec+0x33>
mov    %ebx,%edi
call   1040 <tolower@plt>
movsbl %al,%eax
add    $0xffffffa9,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hexToDec(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isdigit(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %22
11: ; preds = %1
%12 = load i8, i8* %3
%13 = call i64 @isxdigit(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i8, i8* %3
%17 = call signext i8 @tolower(i8 signext %16)
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 97
%20 = add nsw i32 %19, 10
store i32 %20, i32* %2
br label %22
21: ; preds = %11
store i32 -1, i32* %2
br label %22
22: ; preds = %21, %15, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @hexToDec(i8 signext %0) {
%2 = tail call i64 @isdigit(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = sext i8 %0 to i32
%6 = add nsw i32 %5, -48
br label %14
7: ; preds = %1
%8 = tail call i64 @isxdigit(i8 signext %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call signext i8 @tolower(i8 signext %0)
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, -87
br label %14
14: ; preds = %7, %10, %4
%15 = phi i32 [ %6, %4 ], [ %13, %10 ], [ -1, %7 ]
ret i32 %15
}
int right(int i) { return 2 * i + 1; }


x86 assembly (clang, -O0):
<right>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<right>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @right(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 2, %3
%5 = add nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @right(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ glutMouseFunc(void (*)(int, int, int, int));
void s2winMouseFunc(void (*func)(int button, int state, int x, int y)) {
  glutMouseFunc(func);
}


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

x86 assembly (clang, -O2):
<s2winMouseFunc>:
jmp    1030 <glutMouseFunc@plt>

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

LLVM IR (-O2):
define void @s2winMouseFunc(void (i32, i32, i32, i32)* %0) {
%2 = tail call i32 @glutMouseFunc(void (i32, i32, i32, i32)* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
char *unicode_write_string_utf32be_without_bom(int /*<<< orphan*/ *, size_t,
                                               size_t *);
char *unicode_write_string_utf32_without_bom(uint32_t *code_points,
                                             size_t code_points_length,
                                             size_t *string_length_ptr) {
  return unicode_write_string_utf32be_without_bom(
      code_points, code_points_length, string_length_ptr);
}


x86 assembly (clang, -O0):
<unicode_write_string_utf32_without_bom>:
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),%rdx
call   1030 <unicode_write_string_utf32be_without_bom@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unicode_write_string_utf32_without_bom>:
jmp    1030 <unicode_write_string_utf32be_without_bom@plt>

LLVM IR (-O0):
define i8* @unicode_write_string_utf32_without_bom(i32* %0, i64 %1, i64* %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i64*
store i32* %0, i32** %4
store i64 %1, i64* %5
store i64* %2, i64** %6
%7 = load i32*, i32** %4
%8 = load i64, i64* %5
%9 = load i64*, i64** %6
%10 = call i8* @unicode_write_string_utf32be_without_bom(i32* %7, i64 %8, i64* %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @unicode_write_string_utf32_without_bom(i32* %0, i64 %1, i64* %2) {
%4 = tail call i8* @unicode_write_string_utf32be_without_bom(i32* %0, i64 %1, i64* %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ sig_t;

/* Variables and functions */
int /*<<< orphan*/ SIGIO;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
sig_t mazen_sigio() {
  printf("in sigio\n");
  signal(SIGIO, (sig_t)mazen_sigio);
  return 0;
}


x86 assembly (clang, -O0):
<mazen_sigio>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    0x2e98(%rip),%rax
mov    %eax,%esi
call   1040 <signal@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mazen_sigio>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    0x2e9c(%rip),%esi
call   1040 <signal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"in sigio\0A\00"
@SIGIO = global i32 0
define i32 @mazen_sigio() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @SIGIO
%3 = call i32 @signal(i32 %2, i32 ptrtoint (i32 ()* @mazen_sigio to i32))
ret i32 0
}

LLVM IR (-O2):
@SIGIO = global i32 0
@str = [9 x i8] c"in sigio\00"
define i32 @mazen_sigio() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @SIGIO
%3 = tail call i32 @signal(i32 %2, i32 ptrtoint (i32 ()* @mazen_sigio to i32))
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int dobldobl_crude_tracker(int verbose) {
  int fail, *b;
  double *c;
  fail = _ada_use_c2phc4c(623, &verbose, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<dobldobl_crude_tracker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x26f,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_crude_tracker>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x26f,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dobldobl_crude_tracker(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %4
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc4c(i32 623, i32* %2, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @dobldobl_crude_tracker(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 623, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ bar(int);
int /*<<< orphan*/ foo(int);
int main(int argc, char *argv[]) {
  int c = 12;
  if (argc > 1)
    c = atoi(argv[1]);
  foo(c);
  bar(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1167 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <foo@plt>
mov    -0x14(%rbp),%edi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc,%ebx
cmp    $0x2,%edi
jl     1146 <main+0x16>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %ebx,%edi
call   1040 <foo@plt>
mov    %ebx,%edi
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 12, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %9, %2
%15 = load i32, i32* %6
%16 = call i32 @foo(i32 %15)
%17 = load i32, i32* %6
%18 = call i32 @bar(i32 %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 12, %2 ]
%10 = tail call i32 @foo(i32 %9)
%11 = tail call i32 @bar(i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ POP_STACK();
int /*<<< orphan*/ do_return(int /*<<< orphan*/);
void zret_popped(void) { do_return(POP_STACK()); }


x86 assembly (clang, -O0):
<zret_popped>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <POP_STACK@plt>
mov    %eax,%edi
call   1030 <do_return@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zret_popped>:
push   %rax
xor    %eax,%eax
call   1040 <POP_STACK@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <do_return@plt>

LLVM IR (-O0):
define void @zret_popped() {
%1 = call i32 (...) @POP_STACK()
%2 = call i32 @do_return(i32 %1)
ret void
}

LLVM IR (-O2):
define void @zret_popped() {
%1 = tail call i32 (...) @POP_STACK()
%2 = tail call i32 @do_return(i32 %1)
ret void
}
/* Variables and functions */
float Lerp(float, float, double);
float Midpoint(float p1, float p2) { return Lerp(p1, p2, 0.5); }


x86 assembly (clang, -O0):
<Midpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movsd  0xecc(%rip),%xmm2
call   1030 <Lerp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Midpoint>:
movsd  0xee8(%rip),%xmm2
jmp    1030 <Lerp@plt>

LLVM IR (-O0):
define float @Midpoint(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 @Lerp(float %5, float %6, double 5.000000e-01)
ret float %7
}

LLVM IR (-O2):
define float @Midpoint(float %0, float %1) {
%3 = tail call float @Lerp(float %0, float %1, double 5.000000e-01)
ret float %3
}
void __attribute__((cold, used)) used_cold_fn(void) {}


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

x86 assembly (clang, -O2):
<used_cold_fn>:
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @used_cold_fn to i8*)], section "llvm.metadata"
define void @used_cold_fn() {
ret void
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @used_cold_fn to i8*)], section "llvm.metadata"
define void @used_cold_fn() {
ret void
}
void RTStrGetCpInternal(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrGetCpInternal() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ real_evsource_kb_destroy(int);
void evsource_kb_destroy(int sign) { real_evsource_kb_destroy(-11); }


x86 assembly (clang, -O0):
<evsource_kb_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xfffffff5,%edi
call   1030 <real_evsource_kb_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evsource_kb_destroy>:
mov    $0xfffffff5,%edi
jmp    1030 <real_evsource_kb_destroy@plt>

LLVM IR (-O0):
define void @evsource_kb_destroy(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @real_evsource_kb_destroy(i32 -11)
ret void
}

LLVM IR (-O2):
define void @evsource_kb_destroy(i32 %0) {
%2 = tail call i32 @real_evsource_kb_destroy(i32 -11)
ret void
}
int g_DUMMY_menu_append_pixtoggle(int menu_id, char *pixinfo[],
                                  char *pixgrayinfo[], char *pixselectinfo[],
                                  char *pixselectgrayinfo[], int return_id,
                                  int toggle_on) {
  menu_id = menu_id;
  pixinfo = pixinfo;
  pixgrayinfo = pixgrayinfo;
  pixselectinfo = pixselectinfo;
  pixselectgrayinfo = pixselectgrayinfo;
  return_id = return_id;
  toggle_on = toggle_on;
  return -1;
}


x86 assembly (clang, -O0):
<g_DUMMY_menu_append_pixtoggle>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @g_DUMMY_menu_append_pixtoggle(i32 %0, i8** %1, i8** %2, i8** %3, i8** %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8**
%11 = alloca i8**
%12 = alloca i8**
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %8
store i8** %1, i8*** %9
store i8** %2, i8*** %10
store i8** %3, i8*** %11
store i8** %4, i8*** %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32, i32* %8
store i32 %15, i32* %8
%16 = load i8**, i8*** %9
store i8** %16, i8*** %9
%17 = load i8**, i8*** %10
store i8** %17, i8*** %10
%18 = load i8**, i8*** %11
store i8** %18, i8*** %11
%19 = load i8**, i8*** %12
store i8** %19, i8*** %12
%20 = load i32, i32* %13
store i32 %20, i32* %13
%21 = load i32, i32* %14
store i32 %21, i32* %14
ret i32 -1
}

LLVM IR (-O2):
define i32 @g_DUMMY_menu_append_pixtoggle(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2, i8** nocapture readnone %3, i8** nocapture readnone %4, i32 %5, i32 %6) {
ret i32 -1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  void *font_set;
};
typedef TYPE_1__ XwcTextItem;

/* Variables and functions */
void set_XwcTextItem_font_set(void *_p, void *_v) {
  ((XwcTextItem *)_p)->font_set = (void *)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i8* }
define void @set_XwcTextItem_font_set(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i8* %5, i8** %8
ret void
}

LLVM IR (-O2):
define void @set_XwcTextItem_font_set(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}