#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct process_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ call_on_line(char *, void (*)(char *, struct process_info *),
                                struct process_info *);
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ memcpy(char *, char *, scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(char *);
void process_file(char *subprocdir, char *info_file,
                  void (*action)(char *, struct process_info *),
                  struct process_info *data) {
  char *file_to_read = malloc(strlen(subprocdir) + strlen(info_file) + 1);
  memcpy(file_to_read, subprocdir, strlen(subprocdir) + 1);
  strcat(file_to_read, info_file);
  call_on_line(file_to_read, action, data);
  free(file_to_read);
  return;
}


x86 assembly (clang, -O0):
<process_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <memcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <call_on_line@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x1,%rdi
add    $0x1,%rbx
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <memcpy@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1070 <call_on_line@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.process_info = type { i32 }
define void @process_file(i8* %0, i8* %1, void (i8*, %struct.process_info*)* %2, %struct.process_info* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca void (i8*, %struct.process_info*)*
%8 = alloca %struct.process_info*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store void (i8*, %struct.process_info*)* %2, void (i8*, %struct.process_info*)** %7
store %struct.process_info* %3, %struct.process_info** %8
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = load i8*, i8** %6
%13 = call i64 @strlen(i8* %12)
%14 = add nsw i64 %11, %13
%15 = add nsw i64 %14, 1
%16 = call i8* @malloc(i64 %15)
store i8* %16, i8** %9
%17 = load i8*, i8** %9
%18 = load i8*, i8** %5
%19 = load i8*, i8** %5
%20 = call i64 @strlen(i8* %19)
%21 = add nsw i64 %20, 1
%22 = call i32 @memcpy(i8* %17, i8* %18, i64 %21)
%23 = load i8*, i8** %9
%24 = load i8*, i8** %6
%25 = call i32 @strcat(i8* %23, i8* %24)
%26 = load i8*, i8** %9
%27 = load void (i8*, %struct.process_info*)*, void (i8*, %struct.process_info*)** %7
%28 = load %struct.process_info*, %struct.process_info** %8
%29 = call i32 @call_on_line(i8* %26, void (i8*, %struct.process_info*)* %27, %struct.process_info* %28)
%30 = load i8*, i8** %9
%31 = call i32 @free(i8* %30)
ret void
}

LLVM IR (-O2):
%struct.process_info = type { i32 }
define void @process_file(i8* %0, i8* %1, void (i8*, %struct.process_info*)* %2, %struct.process_info* %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%7 = add i64 %5, 1
%8 = add i64 %7, %6
%9 = tail call i8* @malloc(i64 %8)
%10 = tail call i32 @memcpy(i8* %9, i8* %0, i64 %7)
%11 = tail call i32 @strcat(i8* %9, i8* %1)
%12 = tail call i32 @call_on_line(i8* %9, void (i8*, %struct.process_info*)* %2, %struct.process_info* %3)
%13 = tail call i32 @free(i8* %9)
ret void
}