xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ doubles_mat44_inv(double const *, double *);
int /*<<< orphan*/ doubles_mat44_transform_xyz(double *, double const *,
                                               double *);
void doubles_mat44_inv_transform_xyz(const double M[16], const double in[3],
                                     double out[3]) {
  double T[16];
  doubles_mat44_inv(M, T);
  doubles_mat44_transform_xyz(T, in, out);
}


x86 assembly (clang, -O0):
<doubles_mat44_inv_transform_xyz>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1040 <doubles_mat44_inv@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <doubles_mat44_transform_xyz@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubles_mat44_inv_transform_xyz>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rsp,%r15
mov    %r15,%rsi
call   1040 <doubles_mat44_inv@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <doubles_mat44_transform_xyz@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @doubles_mat44_inv_transform_xyz(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [16 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %4
%9 = getelementptr inbounds [16 x double], [16 x double]* %7, i64 0, i64 0
%10 = call i32 @doubles_mat44_inv(double* %8, double* %9)
%11 = getelementptr inbounds [16 x double], [16 x double]* %7, i64 0, i64 0
%12 = load double*, double** %5
%13 = load double*, double** %6
%14 = call i32 @doubles_mat44_transform_xyz(double* %11, double* %12, double* %13)
ret void
}

LLVM IR (-O2):
define void @doubles_mat44_inv_transform_xyz(double* %0, double* %1, double* %2) {
%4 = alloca [16 x double]
%5 = bitcast [16 x double]* %4 to i8*
%6 = getelementptr inbounds [16 x double], [16 x double]* %4, i64 0, i64 0
%7 = call i32 @doubles_mat44_inv(double* %0, double* %6)
%8 = call i32 @doubles_mat44_transform_xyz(double* %6, double* %1, double* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ i2c_debug(char const *, int);
void i2c_error(const char *s) { i2c_debug(s, 5); }


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

x86 assembly (clang, -O2):
<i2c_error>:
mov    $0x5,%esi
jmp    1030 <i2c_debug@plt>

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

LLVM IR (-O2):
define void @i2c_error(i8* %0) {
%2 = tail call i32 @i2c_debug(i8* %0, i32 5)
ret void
}
int head(int a[]) { return a[0]; }


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

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

LLVM IR (-O0):
define i32 @head(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @head(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
double cc_thermometer_to_temperature(double thermo) {
  return (thermo - 19791.268) / 32728.0 * 1.25 / 0.00247;
}


x86 assembly (clang, -O0):
<cc_thermometer_to_temperature>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xf02(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeee(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeda(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec6(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cc_thermometer_to_temperature>:
addsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @cc_thermometer_to_temperature(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 0x40D353D126E978D5
%5 = fdiv double %4, 3.272800e+04
%6 = fmul double %5, 1.250000e+00
%7 = fdiv double %6, 2.470000e-03
ret double %7
}

LLVM IR (-O2):
define double @cc_thermometer_to_temperature(double %0) {
%2 = fadd double %0, 0xC0D353D126E978D5
%3 = fdiv double %2, 3.272800e+04
%4 = fmul double %3, 1.250000e+00
%5 = fdiv double %4, 2.470000e-03
ret double %5
}
/* Variables and functions */
char getchar();
void clear(void) {
  while (getchar() != '\n')
    ;
}


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <clear+0x9>
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1131 <clear+0x21>
jmp    1119 <clear+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <clear+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @clear() {
br label %1
1: ; preds = %5, %0
%2 = call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @clear() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f0();
int /*<<< orphan*/ f1();
void test() {
  f0();
  f1();
}


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

x86 assembly (clang, -O2):
<test>:
push   %rax
xor    %eax,%eax
call   1030 <f0@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <f1@plt>

LLVM IR (-O0):
define void @test() {
%1 = call i32 (...) @f0()
%2 = call i32 (...) @f1()
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 (...) @f0()
%2 = tail call i32 (...) @f1()
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void *ic_alloc(size_t size) {
  void *v = 0;
  if (size == 0) {
    size = 1;
  }
  v = calloc(1, size);
  if (!v) {
    puts("ic_alloc: call to calloc failed");
    exit(1);
  }
  return v;
}


x86 assembly (clang, -O0):
<ic_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1157 <ic_alloc+0x27>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118a <ic_alloc+0x5a>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_alloc>:
push   %rax
test   %rdi,%rdi
mov    $0x1,%esi
cmovne %rdi,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
test   %rax,%rax
je     114e <ic_alloc+0x1e>
pop    %rcx
ret
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"ic_alloc: call to calloc failed\00"
define i8* @ic_alloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* null, i8** %3
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 1, i64* %2
br label %7
7: ; preds = %6, %1
%8 = load i64, i64* %2
%9 = call i8* @calloc(i32 1, i64 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %7
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [32 x i8] c"ic_alloc: call to calloc failed\00"
define i8* @ic_alloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 1, i64 %0
%4 = tail call i8* @calloc(i32 1, i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ NumberIO_StrToOct(char *, int, unsigned int *);
int /*<<< orphan*/ StrIO_ReadString(char *, int);
void NumberIO_ReadOct(unsigned int *x) {
  typedef struct _T10_a _T10;
  struct _T10_a {
    char array[79 + 1];
  };
  _T10 a;
  StrIO_ReadString((char *)&a.array[0], 79);
  NumberIO_StrToOct((char *)&a.array[0], 79, x);
}


x86 assembly (clang, -O0):
<NumberIO_ReadOct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x58(%rbp),%rdi
mov    $0x4f,%esi
call   1040 <StrIO_ReadString@plt>
lea    -0x58(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x4f,%esi
call   1030 <NumberIO_StrToOct@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NumberIO_ReadOct>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x4f,%esi
call   1040 <StrIO_ReadString@plt>
mov    %r14,%rdi
mov    $0x4f,%esi
mov    %rbx,%rdx
call   1030 <NumberIO_StrToOct@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct._T10_a = type { [80 x i8] }
define void @NumberIO_ReadOct(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct._T10_a
store i32* %0, i32** %2
%4 = getelementptr inbounds %struct._T10_a, %struct._T10_a* %3, i32 0, i32 0
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%6 = call i32 @StrIO_ReadString(i8* %5, i32 79)
%7 = getelementptr inbounds %struct._T10_a, %struct._T10_a* %3, i32 0, i32 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%9 = load i32*, i32** %2
%10 = call i32 @NumberIO_StrToOct(i8* %8, i32 79, i32* %9)
ret void
}

LLVM IR (-O2):
%struct._T10_a = type { [80 x i8] }
define void @NumberIO_ReadOct(i32* %0) {
%2 = alloca %struct._T10_a
%3 = getelementptr inbounds %struct._T10_a, %struct._T10_a* %2, i64 0, i32 0, i64 0
%4 = call i32 @StrIO_ReadString(i8* %3, i32 79)
%5 = call i32 @NumberIO_StrToOct(i8* %3, i32 79, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void yyerror(char const *s) { fprintf(stderr, "%s\n", s); }


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @yyerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @yyerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef long uint32_t;
struct itimer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ timer_interval_start(struct itimer *, long);
void timer_interval_start_seconds(struct itimer *t, uint32_t seconds) {
  uint32_t interval = seconds;
  interval *= 1000L;
  timer_interval_start(t, interval);
}


x86 assembly (clang, -O0):
<timer_interval_start_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
imul   $0x3e8,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <timer_interval_start@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_interval_start_seconds>:
imul   $0x3e8,%rsi,%rsi
jmp    1030 <timer_interval_start@plt>

LLVM IR (-O0):
%struct.itimer = type { i32 }
define void @timer_interval_start_seconds(%struct.itimer* %0, i64 %1) {
%3 = alloca %struct.itimer*
%4 = alloca i64
%5 = alloca i64
store %struct.itimer* %0, %struct.itimer** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
store i64 %6, i64* %5
%7 = load i64, i64* %5
%8 = mul nsw i64 %7, 1000
store i64 %8, i64* %5
%9 = load %struct.itimer*, %struct.itimer** %3
%10 = load i64, i64* %5
%11 = call i32 @timer_interval_start(%struct.itimer* %9, i64 %10)
ret void
}

LLVM IR (-O2):
%struct.itimer = type { i32 }
define void @timer_interval_start_seconds(%struct.itimer* %0, i64 %1) {
%3 = mul nsw i64 %1, 1000
%4 = tail call i32 @timer_interval_start(%struct.itimer* %0, i64 %3)
ret void
}
/* Type definitions */
struct in_addr {
  int s_addr;
};
typedef int in_addr_t;

/* Variables and functions */
int htonl(int);
int inet_addr(char const *);
char *inet_ntoa(struct in_addr);
int ntohl(int);
char *increment_address(const char *address_string, int by) {
  in_addr_t address = inet_addr(address_string);
  address = ntohl(address);
  address += by;
  address = htonl(address);
  struct in_addr address_struct;
  address_struct.s_addr = address;
  return inet_ntoa(address_struct);
}


x86 assembly (clang, -O0):
<increment_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <inet_addr@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <ntohl@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <htonl@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <inet_ntoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment_address>:
push   %rbx
mov    %esi,%ebx
call   1050 <inet_addr@plt>
mov    %eax,%edi
call   1060 <ntohl@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1040 <htonl@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <inet_ntoa@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
define i8* @increment_address(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.in_addr
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @inet_addr(i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @ntohl(i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %12, %11
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = call i32 @htonl(i32 %14)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
store i32 %16, i32* %17
%18 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%19 = load i32, i32* %18
%20 = call i8* @inet_ntoa(i32 %19)
ret i8* %20
}

LLVM IR (-O2):
define i8* @increment_address(i8* %0, i32 %1) {
%3 = tail call i32 @inet_addr(i8* %0)
%4 = tail call i32 @ntohl(i32 %3)
%5 = add nsw i32 %4, %1
%6 = tail call i32 @htonl(i32 %5)
%7 = tail call i8* @inet_ntoa(i32 %6)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ do_select_init();
void comm_select_init(void) { do_select_init(); }


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

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

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

LLVM IR (-O2):
define void @comm_select_init() {
%1 = tail call i32 (...) @do_select_init()
ret void
}
int rl_undo_command(count, key)
int count, key __attribute__((unused));
{
  if (count < 0)
    return 0;
  while (count) {
    if (rl_do_undo())
      count--;
    else {
      rl_ding();
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<rl_undo_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1144 <rl_undo_command+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1189 <rl_undo_command+0x69>
jmp    1149 <rl_undo_command+0x29>
cmpl   $0x0,-0x8(%rbp)
je     1182 <rl_undo_command+0x62>
mov    $0x0,%al
call   1030 <rl_do_undo@plt>
cmp    $0x0,%eax
je     1171 <rl_undo_command+0x51>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    117d <rl_undo_command+0x5d>
mov    $0x0,%al
call   1040 <rl_ding@plt>
jmp    1182 <rl_undo_command+0x62>
jmp    1149 <rl_undo_command+0x29>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rl_undo_command>:
push   %rbx
test   %edi,%edi
jle    1149 <rl_undo_command+0x29>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rl_do_undo@plt>
test   %eax,%eax
je     1142 <rl_undo_command+0x22>
add    $0xffffffff,%ebx
jne    1130 <rl_undo_command+0x10>
jmp    1149 <rl_undo_command+0x29>
xor    %eax,%eax
call   1040 <rl_ding@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rl_undo_command(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %23
9: ; preds = %2
br label %10
10: ; preds = %21, %9
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = call i32 (...) @rl_do_undo()
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
br label %21
19: ; preds = %13
%20 = call i32 (...) @rl_ding()
br label %22
21: ; preds = %16
br label %10
22: ; preds = %19, %10
store i32 0, i32* %3
br label %23
23: ; preds = %22, %8
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @rl_undo_command(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %13, label %6
4: ; preds = %6
%5 = icmp eq i32 %10, 0
br i1 %5, label %13, label %6
6: ; preds = %2, %4
%7 = phi i32 [ %10, %4 ], [ %0, %2 ]
%8 = tail call i32 (...) @rl_do_undo()
%9 = icmp eq i32 %8, 0
%10 = add nsw i32 %7, -1
br i1 %9, label %11, label %4
11: ; preds = %6
%12 = tail call i32 (...) @rl_ding()
br label %13
13: ; preds = %4, %11, %2
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
struct crc_config {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ crc_finalize(struct crc_config *, int /*<<< orphan*/);
int /*<<< orphan*/ crc_init(struct crc_config *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/);
uint64_t crc_calculate(struct crc_config *cfg, uint8_t *data, uint64_t len) {
  uint64_t crc = crc_init(cfg, data, len);
  return crc_finalize(cfg, crc);
}


x86 assembly (clang, -O0):
<crc_calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <crc_init@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <crc_finalize@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc_calculate>:
push   %rbx
mov    %rdi,%rbx
call   1040 <crc_init@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <crc_finalize@plt>

LLVM IR (-O0):
%struct.crc_config = type { i32 }
define i32 @crc_calculate(%struct.crc_config* %0, i32* %1, i32 %2) {
%4 = alloca %struct.crc_config*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store %struct.crc_config* %0, %struct.crc_config** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = load %struct.crc_config*, %struct.crc_config** %4
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = call i32 @crc_init(%struct.crc_config* %8, i32* %9, i32 %10)
store i32 %11, i32* %7
%12 = load %struct.crc_config*, %struct.crc_config** %4
%13 = load i32, i32* %7
%14 = call i32 @crc_finalize(%struct.crc_config* %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.crc_config = type { i32 }
define i32 @crc_calculate(%struct.crc_config* %0, i32* %1, i32 %2) {
%4 = tail call i32 @crc_init(%struct.crc_config* %0, i32* %1, i32 %2)
%5 = tail call i32 @crc_finalize(%struct.crc_config* %0, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rob4(int *, int);
int main() {
  int a[] = {1, 2, 3, 4, 5};
  int res = rob4(a, sizeof a / sizeof a[0]);
  printf("res=%d\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <rob4@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <rob4@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [8 x i8] c"res=%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @rob4(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mat_pow(int **, int);
int fibo(int n) {
  int F[2][2] = {{1, 1}, {1, 0}};
  if (n == 0)
    return 0;
  mat_pow(F, n - 1);
  return F[0][0];
}


x86 assembly (clang, -O0):
<fibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1147 <fibo+0x37>
movl   $0x0,-0x4(%rbp)
jmp    115c <fibo+0x4c>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1030 <mat_pow@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
test   %edi,%edi
je     1138 <fibo+0x28>
mov    %edi,%esi
add    $0xffffffff,%esi
mov    %rsp,%rdi
call   1030 <mat_pow@plt>
mov    (%rsp),%eax
add    $0x18,%rsp
ret
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.fibo.F = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 0]]
define i32 @fibo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x [2 x i32]]
store i32 %0, i32* %3
%5 = bitcast [2 x [2 x i32]]* %4 to i8*
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %18
9: ; preds = %1
%10 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 0
%11 = bitcast [2 x i32]* %10 to i32**
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call i32 @mat_pow(i32** %11, i32 %13)
%15 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %15, i64 0, i64 0
%17 = load i32, i32* %16
store i32 %17, i32* %2
br label %18
18: ; preds = %9, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@__const.fibo.F = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 0]]
define i32 @fibo(i32 %0) {
%2 = alloca [2 x [2 x i32]]
%3 = bitcast [2 x [2 x i32]]* %2 to i8*
%4 = icmp eq i32 %0, 0
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = bitcast [2 x [2 x i32]]* %2 to i32**
%7 = add nsw i32 %0, -1
%8 = call i32 @mat_pow(i32** %6, i32 %7)
%9 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %2, i64 0, i64 0, i64 0
%10 = load i32, i32* %9
br label %11
11: ; preds = %1, %5
%12 = phi i32 [ %10, %5 ], [ 0, %1 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello world!");
  printf("Hola mundo!");
  printf("Bonjour le monde!");
  printf("Hallo verden!");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
@.str.1 = [12 x i8] c"Hola mundo!\00"
@.str.2 = [18 x i8] c"Bonjour le monde!\00"
@.str.3 = [14 x i8] c"Hallo verden!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
@.str.1 = [12 x i8] c"Hola mundo!\00"
@.str.2 = [18 x i8] c"Bonjour le monde!\00"
@.str.3 = [14 x i8] c"Hallo verden!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
int send_cmdSock(sock, cmd)
int sock;
char *cmd;
{
  int len;
  len = write(sock, cmd, strlen(cmd));
  if (len < strlen(cmd))
    return (-1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<send_cmdSock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jae    1187 <send_cmdSock+0x67>
movl   $0xffffffff,-0x4(%rbp)
jmp    118e <send_cmdSock+0x6e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_cmdSock>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <write@plt>
movslq %eax,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbp
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @send_cmdSock(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
%11 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %7, i8* %8, i64 %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = load i8*, i8** %5
%15 = call i64 @strlen(i8* %14)
%16 = icmp ult i64 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %19
18: ; preds = %2
store i32 0, i32* %3
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @send_cmdSock(i32 %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %1, i64 %3)
%5 = sext i32 %4 to i64
%6 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%7 = icmp ugt i64 %6, %5
%8 = sext i1 %7 to i32
ret i32 %8
}
int execute_setgid32() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_setgid32() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_setgid32() {
ret i32 0
}
int isalnum(c)
char c;
{ return isalph(c) || isnum(c); }


x86 assembly (clang, -O0):
<isalnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
mov    $0x0,%al
call   1030 <isalph@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    115d <isalnum+0x3d>
movsbl -0x1(%rbp),%edi
mov    $0x0,%al
call   1040 <isnum@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalnum>:
push   %rbx
movsbl %dil,%ebx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <isalph@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     113b <isalnum+0x1b>
pop    %rbx
ret
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <isnum@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isalnum(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 (i32, ...) bitcast (i32 (...)* @isalph to i32 (i32, ...)*)(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = call i32 (i32, ...) bitcast (i32 (...)* @isnum to i32 (i32, ...)*)(i32 %10)
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %8, %1
%14 = phi i1 [ true, %1 ], [ %12, %8 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @isalnum(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @isalph to i32 (i32, ...)*)(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @isnum to i32 (i32, ...)*)(i32 %3)
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %1
%11 = phi i32 [ 1, %1 ], [ %9, %6 ]
ret i32 %11
}
const struct my_struct *func_ro(const struct my_struct *s) { return s; }


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

x86 assembly (clang, -O2):
<func_ro>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.my_struct = type opaque
define %struct.my_struct* @func_ro(%struct.my_struct* %0) {
%2 = alloca %struct.my_struct*
store %struct.my_struct* %0, %struct.my_struct** %2
%3 = load %struct.my_struct*, %struct.my_struct** %2
ret %struct.my_struct* %3
}

LLVM IR (-O2):
%struct.my_struct = type opaque
define %struct.my_struct* @func_ro(%struct.my_struct* readnone returned %0) {
ret %struct.my_struct* %0
}
/* Variables and functions */
int fat(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int n = 10;
  printf("Fatorial de %d: %d", n, fat(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fat@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <fat@plt>
lea    0xece(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Fatorial de %d: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @fat(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Fatorial de %d: %d\00"
define i32 @main() {
%1 = tail call i32 @fat(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 10, i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ eprintf(char *, size_t);
void *realloc(void *, size_t);
void *erealloc(void *p, size_t n) {
  p = realloc(p, n);
  if (p == NULL)
    eprintf("realloc of %u bytes failed:", n);
  return p;
}


x86 assembly (clang, -O0):
<erealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115c <erealloc+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <eprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <erealloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <eprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"realloc of %u bytes failed:\00"
define i8* @erealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i64, i64* %4
%12 = call i32 @eprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %11)
br label %13
13: ; preds = %10, %2
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [28 x i8] c"realloc of %u bytes failed:\00"
define noalias i8* @erealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @eprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int japi_textfield(int, int);
int j_textfield(int arg0, int arg1) { return (japi_textfield(arg0, arg1)); }


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

x86 assembly (clang, -O2):
<j_textfield>:
jmp    1030 <japi_textfield@plt>

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

LLVM IR (-O2):
define i32 @j_textfield(i32 %0, i32 %1) {
%3 = tail call i32 @japi_textfield(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  assert(-1 == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
int ril_util_convert_signal_strength(int strength) {
  int result;
  if (strength == 99)
    result = -1;
  else
    result = (strength * 100) / 31;
  return result;
}


x86 assembly (clang, -O0):
<ril_util_convert_signal_strength>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x63,-0x4(%rbp)
jne    111d <ril_util_convert_signal_strength+0x1d>
movl   $0xffffffff,-0x8(%rbp)
jmp    112c <ril_util_convert_signal_strength+0x2c>
imul   $0x64,-0x4(%rbp),%eax
mov    $0x1f,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ril_util_convert_signal_strength>:
mov    $0xffffffff,%eax
cmp    $0x63,%edi
je     1126 <ril_util_convert_signal_strength+0x26>
imul   $0x64,%edi,%eax
cltq
imul   $0xffffffff84210843,%rax,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x4,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ril_util_convert_signal_strength(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 99
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -1, i32* %3
br label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 100
%10 = sdiv i32 %9, 31
store i32 %10, i32* %3
br label %11
11: ; preds = %7, %6
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @ril_util_convert_signal_strength(i32 %0) {
%2 = icmp eq i32 %0, 99
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = mul nsw i32 %0, 100
%5 = sdiv i32 %4, 31
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ -1, %1 ]
ret i32 %7
}
void jmpesp() { __asm__("jmpq *%rax"); }


x86 assembly (clang, -O0):
<jmpesp>:
push   %rbp
mov    %rsp,%rbp
jmp    *%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jmpesp>:
jmp    *%rax
ret

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

LLVM IR (-O2):
define void @jmpesp() {
tail call void asm sideeffect "jmpq *%rax", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ roll(int);
int main() {
  roll(-1);
  roll(0);
  roll(1);
  roll(10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <roll@plt>
xor    %edi,%edi
call   1030 <roll@plt>
mov    $0x1,%edi
call   1030 <roll@plt>
mov    $0xa,%edi
call   1030 <roll@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <roll@plt>
xor    %edi,%edi
call   1030 <roll@plt>
mov    $0x1,%edi
call   1030 <roll@plt>
mov    $0xa,%edi
call   1030 <roll@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @roll(i32 -1)
%2 = call i32 @roll(i32 0)
%3 = call i32 @roll(i32 1)
%4 = call i32 @roll(i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @roll(i32 -1)
%2 = tail call i32 @roll(i32 0)
%3 = tail call i32 @roll(i32 1)
%4 = tail call i32 @roll(i32 10)
ret i32 0
}
void rop3_33_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D ^ T;
  stk1 = S | stk2;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_33_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_33_0_0>:
xor    (%rdi),%dl
or     %sil,%dl
not    %dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_33_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = xor i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %8
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = or i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = xor i32 %23, -1
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = load i8*, i8** %4
store i8 %26, i8* %27
ret void
}

LLVM IR (-O2):
define void @rop3_33_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, %2
%6 = or i8 %5, %1
%7 = xor i8 %6, -1
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ myprintf(char *, char *, int);
int main(int argc, char **argv) {
  myprintf("yes", "hello world %d\n", 12);
  return 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    0xed3(%rip),%rdi
lea    0xed0(%rip),%rsi
mov    $0xc,%edx
call   1030 <myprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee5(%rip),%rsi
mov    $0xc,%edx
call   1030 <myprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"yes\00"
@.str.1 = [16 x i8] c"hello world %d\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 @myprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"yes\00"
@.str.1 = [16 x i8] c"hello world %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @myprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 12)
ret i32 0
}
const char *SCE_Time_GetDay(const unsigned int nb) {
  static const char days[7][4] = {"Sun", "Mon", "Tue", "Wed",
                                  "Thu", "Fri", "Sat"};
  return days[nb];
}


x86 assembly (clang, -O0):
<SCE_Time_GetDay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xeed(%rip),%rax
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Time_GetDay>:
mov    %edi,%eax
lea    0xef7(%rip),%rcx
lea    (%rcx,%rax,4),%rax
ret

LLVM IR (-O0):
@SCE_Time_GetDay.days = internal constant [7 x [4 x i8]] [[4 x i8] c"Sun\00", [4 x i8] c"Mon\00", [4 x i8] c"Tue\00", [4 x i8] c"Wed\00", [4 x i8] c"Thu\00", [4 x i8] c"Fri\00", [4 x i8] c"Sat\00"]
define i8* @SCE_Time_GetDay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [7 x [4 x i8]], [7 x [4 x i8]]* @SCE_Time_GetDay.days, i64 0, i64 %4
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
ret i8* %6
}

LLVM IR (-O2):
@SCE_Time_GetDay.days = internal constant [7 x [4 x i8]] [[4 x i8] c"Sun\00", [4 x i8] c"Mon\00", [4 x i8] c"Tue\00", [4 x i8] c"Wed\00", [4 x i8] c"Thu\00", [4 x i8] c"Fri\00", [4 x i8] c"Sat\00"]
define i8* @SCE_Time_GetDay(i32 %0) {
%2 = zext i32 %0 to i64
%3 = getelementptr inbounds [7 x [4 x i8]], [7 x [4 x i8]]* @SCE_Time_GetDay.days, i64 0, i64 %2, i64 0
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ cvr_pipemsg_send(unsigned int, int /*<<< orphan*/,
                                    int /*<<< orphan*/ *);
void cvr_response_cmd(unsigned int msgId) { cvr_pipemsg_send(msgId, 0, NULL); }


x86 assembly (clang, -O0):
<cvr_response_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <cvr_pipemsg_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvr_response_cmd>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <cvr_pipemsg_send@plt>

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

LLVM IR (-O2):
define void @cvr_response_cmd(i32 %0) {
%2 = tail call i32 @cvr_pipemsg_send(i32 %0, i32 0, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log_allocation(char *, size_t, void *);
void *real_calloc(size_t, size_t);
void *calloc(size_t nmemb, size_t size) {
  void *ptr = real_calloc(nmemb, size);
  log_allocation("calloc", size * nmemb, ptr);
  return ptr;
}


x86 assembly (clang, -O0):
<calloc>:
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 <real_calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
imul   -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeab(%rip),%rdi
call   1040 <log_allocation@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <real_calloc@plt>
mov    %rax,%r15
imul   %r14,%rbx
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <log_allocation@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"calloc\00"
define i8* @calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @real_calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i64, i64* %4
%10 = load i64, i64* %3
%11 = mul i64 %9, %10
%12 = load i8*, i8** %5
%13 = call i32 @log_allocation(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %11, i8* %12)
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"calloc\00"
define i8* @calloc(i64 %0, i64 %1) {
%3 = tail call i8* @real_calloc(i64 %0, i64 %1)
%4 = mul i64 %1, %0
%5 = tail call i32 @log_allocation(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %4, i8* %3)
ret i8* %3
}